diff options
author | Thom May <thom@chef.io> | 2015-12-02 12:19:33 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-01-11 15:40:42 +0000 |
commit | d99e306a41b1402209d320cb7119b12a3bbb962f (patch) | |
tree | f65940702826deb991e6198967d3e9e96cb2857a /spec/unit/run_list_spec.rb | |
parent | 1b71aeb423b009f6d1a44215c89e9976957b47e9 (diff) | |
download | chef-d99e306a41b1402209d320cb7119b12a3bbb962f.tar.gz |
Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_rest
In the process, stop auto-expanding JSON in the HTTP client, and let
individual classes control that themselves.
Fixes #2737, Fixes #3518
Diffstat (limited to 'spec/unit/run_list_spec.rb')
-rw-r--r-- | spec/unit/run_list_spec.rb | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/spec/unit/run_list_spec.rb b/spec/unit/run_list_spec.rb index e150579431..634b5c54cf 100644 --- a/spec/unit/run_list_spec.rb +++ b/spec/unit/run_list_spec.rb @@ -172,10 +172,11 @@ describe Chef::RunList do @role.run_list "one", "two" @role.default_attributes :one => :two @role.override_attributes :three => :four + @role.env_run_list["production"] = Chef::RunList.new( "one", "two", "five") allow(Chef::Role).to receive(:load).and_return(@role) - @rest = double("Chef::REST", { :get_rest => @role, :url => "/" }) - allow(Chef::REST).to receive(:new).and_return(@rest) + @rest = double("Chef::ServerAPI", { :get => @role.to_hash, :url => "/" }) + allow(Chef::ServerAPI).to receive(:new).and_return(@rest) @run_list << "role[stubby]" @run_list << "kitty" @@ -196,21 +197,17 @@ describe Chef::RunList do describe "from the chef server" do it "should load the role from the chef server" do - #@rest.should_receive(:get_rest).with("roles/stubby") + #@rest.should_receive(:get).with("roles/stubby") expansion = @run_list.expand("_default", "server") expect(expansion.recipes).to eq(['one', 'two', 'kitty']) end it "should default to expanding from the server" do - expect(@rest).to receive(:get_rest).with("roles/stubby") + expect(@rest).to receive(:get).with("roles/stubby") @run_list.expand("_default") end describe "with an environment set" do - before do - @role.env_run_list["production"] = Chef::RunList.new( "one", "two", "five") - end - it "expands the run list using the environment specific run list" do expansion = @run_list.expand("production", "server") expect(expansion.recipes).to eq(%w{one two five kitty}) @@ -218,7 +215,7 @@ describe Chef::RunList do describe "and multiply nested roles" do before do - @multiple_rest_requests = double("Chef::REST") + @multiple_rest_requests = double("Chef::ServerAPI") @role.env_run_list["production"] << "role[prod-base]" @@ -233,10 +230,10 @@ describe Chef::RunList do end it "expands the run list using the specified environment for all nested roles" do - allow(Chef::REST).to receive(:new).and_return(@multiple_rest_requests) - expect(@multiple_rest_requests).to receive(:get_rest).with("roles/stubby").and_return(@role) - expect(@multiple_rest_requests).to receive(:get_rest).with("roles/prod-base").and_return(@role_prod_base) - expect(@multiple_rest_requests).to receive(:get_rest).with("roles/nested-deeper").and_return(@role_nested_deeper) + allow(Chef::ServerAPI).to receive(:new).and_return(@multiple_rest_requests) + expect(@multiple_rest_requests).to receive(:get).with("roles/stubby").and_return(@role.to_hash) + expect(@multiple_rest_requests).to receive(:get).with("roles/prod-base").and_return(@role_prod_base.to_hash) + expect(@multiple_rest_requests).to receive(:get).with("roles/nested-deeper").and_return(@role_nested_deeper.to_hash) expansion = @run_list.expand("production", "server") expect(expansion.recipes).to eq(%w{one two five prod-secret-sauce kitty}) |