summaryrefslogtreecommitdiff
path: root/spec/unit/knife/cookbook_show_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife/cookbook_show_spec.rb')
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index bf480e3678..a06e53b9a1 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Knife::CookbookShow do
@knife = Chef::Knife::CookbookShow.new
@knife.config = { }
@knife.name_args = [ "cookbook_name" ]
- @rest = double(Chef::REST)
+ @rest = double(Chef::ServerAPI)
allow(@knife).to receive(:rest).and_return(@rest)
allow(@knife).to receive(:pretty_print).and_return(true)
allow(@knife).to receive(:output).and_return(true)
@@ -56,14 +56,14 @@ describe Chef::Knife::CookbookShow do
end
it "should show the raw cookbook data" do
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name").and_return(@response)
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name").and_return(@response)
expect(@knife).to receive(:format_cookbook_list_for_display).with(@response)
@knife.run
end
it "should respect the user-supplied environment" do
@knife.config[:environment] = "foo"
- expect(@rest).to receive(:get_rest).with("environments/foo/cookbooks/cookbook_name").and_return(@response)
+ expect(@rest).to receive(:get).with("environments/foo/cookbooks/cookbook_name").and_return(@response)
expect(@knife).to receive(:format_cookbook_list_for_display).with(@response)
@knife.run
end
@@ -76,7 +76,7 @@ describe Chef::Knife::CookbookShow do
end
it "should show the specific part of a cookbook" do
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@response)
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@response)
expect(@knife).to receive(:output).with(@response)
@knife.run
end
@@ -101,7 +101,7 @@ describe Chef::Knife::CookbookShow do
end
it "should print the json of the part" do
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
expect(@knife).to receive(:output).with(@cookbook_response.manifest["recipes"])
@knife.run
end
@@ -125,8 +125,8 @@ describe Chef::Knife::CookbookShow do
end
it "should print the raw result of the request (likely a file!)" do
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get_rest).with("http://example.org/files/default.rb", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("http://example.org/files/default.rb", true).and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -177,8 +177,8 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform] = "example_platform"
@knife.config[:platform_version] = "1.0"
@knife.config[:fqdn] = "examplehost.example.org"
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get_rest).with("http://example.org/files/1111", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("http://example.org/files/1111", true).and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -189,8 +189,8 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform] = "ubuntu"
@knife.config[:platform_version] = "1.0"
@knife.config[:fqdn] = "differenthost.example.org"
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get_rest).with("http://example.org/files/3333", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("http://example.org/files/3333", true).and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -201,8 +201,8 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform] = "ubuntu"
@knife.config[:platform_version] = "9.10"
@knife.config[:fqdn] = "differenthost.example.org"
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get_rest).with("http://example.org/files/2222", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("http://example.org/files/2222", true).and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -210,8 +210,8 @@ describe Chef::Knife::CookbookShow do
describe "with none of the arguments, it should use the default" do
it "should pass them all" do
- expect(@rest).to receive(:get_rest).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get_rest).with("http://example.org/files/4444", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
+ expect(@rest).to receive(:get).with("http://example.org/files/4444", true).and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end