summaryrefslogtreecommitdiff
path: root/spec/unit/knife/cookbook_site_download_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife/cookbook_site_download_spec.rb')
-rw-r--r--spec/unit/knife/cookbook_site_download_spec.rb33
1 files changed, 14 insertions, 19 deletions
diff --git a/spec/unit/knife/cookbook_site_download_spec.rb b/spec/unit/knife/cookbook_site_download_spec.rb
index 530ac576e0..1c680c2f8c 100644
--- a/spec/unit/knife/cookbook_site_download_spec.rb
+++ b/spec/unit/knife/cookbook_site_download_spec.rb
@@ -19,7 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Chef::Knife::CookbookSiteDownload do
-
describe "run" do
before do
@knife = Chef::Knife::CookbookSiteDownload.new
@@ -36,8 +35,8 @@ describe Chef::Knife::CookbookSiteDownload do
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
allow(@knife).to receive(:noauth_rest).and_return(@noauth_rest)
expect(@noauth_rest).to receive(:get).
- with("#{@cookbook_api_url}/apache2").
- and_return(@current_data)
+ with("#{@cookbook_api_url}/apache2").
+ and_return(@current_data)
end
context "when the cookbook is deprecated and not forced" do
@@ -47,9 +46,9 @@ describe Chef::Knife::CookbookSiteDownload do
it "should warn with info about the replacement" do
expect(@knife.ui).to receive(:warn).
- with(/.+deprecated.+replaced by other_apache2.+/i)
+ with(/.+deprecated.+replaced by other_apache2.+/i)
expect(@knife.ui).to receive(:warn).
- with(/use --force.+download.+/i)
+ with(/use --force.+download.+/i)
@knife.run
end
end
@@ -58,7 +57,7 @@ describe Chef::Knife::CookbookSiteDownload do
before do
@cookbook_data = { "version" => @version,
"file" => "http://example.com/apache2_#{@version_us}.tgz" }
- @temp_file = double( :path => "/tmp/apache2_#{@version_us}.tgz" )
+ @temp_file = double( :path => "/tmp/apache2_#{@version_us}.tgz" )
@file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz")
expect(@noauth_rest).to receive(:sign_on_redirect=).with(false)
@@ -67,11 +66,11 @@ describe Chef::Knife::CookbookSiteDownload do
context "downloading the latest version" do
before do
expect(@noauth_rest).to receive(:get).
- with(@current_data["latest_version"]).
- and_return(@cookbook_data)
+ with(@current_data["latest_version"]).
+ and_return(@cookbook_data)
expect(@noauth_rest).to receive(:get).
- with(@cookbook_data["file"], true).
- and_return(@temp_file)
+ with(@cookbook_data["file"], true).
+ and_return(@temp_file)
end
context "and it is deprecated and with --force" do
@@ -82,13 +81,12 @@ describe Chef::Knife::CookbookSiteDownload do
it "should download the latest version" do
expect(@knife.ui).to receive(:warn).
- with(/.+deprecated.+replaced by other_apache2.+/i)
+ with(/.+deprecated.+replaced by other_apache2.+/i)
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
@knife.run
expect(@stderr.string).to match /downloading apache2.+version.+#{Regexp.escape(@version)}/i
expect(@stderr.string).to match /cookbook save.+#{Regexp.escape(@file)}/i
end
-
end
it "should download the latest version" do
@@ -132,20 +130,17 @@ describe Chef::Knife::CookbookSiteDownload do
it "should download the desired version" do
expect(@noauth_rest).to receive(:get).
- with("#{@cookbook_api_url}/apache2/versions/#{@version_us}").
- and_return(@cookbook_data)
+ with("#{@cookbook_api_url}/apache2/versions/#{@version_us}").
+ and_return(@cookbook_data)
expect(@noauth_rest).to receive(:get).
- with(@cookbook_data["file"], true).
- and_return(@temp_file)
+ with(@cookbook_data["file"], true).
+ and_return(@temp_file)
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
@knife.run
expect(@stderr.string).to match /downloading apache2.+version.+#{Regexp.escape(@version)}/i
expect(@stderr.string).to match /cookbook save.+#{Regexp.escape(@file)}/i
end
end
-
end
-
end
-
end