summaryrefslogtreecommitdiff
path: root/spec/unit/knife
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-09 08:17:32 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-09 08:17:32 -0800
commit37e02399a6e1dd281808a556f1420f8cf6e846fd (patch)
tree86834a5371fccfc474004233e45ab00dd7355574 /spec/unit/knife
parentf073747786abbe6ada55ed24b696a03e39c3c45d (diff)
downloadchef-lcg/chefstyle-batch.tar.gz
autofixing auto-inserted delimiterslcg/chefstyle-batch
Diffstat (limited to 'spec/unit/knife')
-rw-r--r--spec/unit/knife/bootstrap/chef_vault_handler_spec.rb4
-rw-r--r--spec/unit/knife/bootstrap_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_list_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_site_install_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_test_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb10
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/ui_spec.rb16
-rw-r--r--spec/unit/knife/environment_compare_spec.rb2
-rw-r--r--spec/unit/knife/node_environment_set_spec.rb2
-rw-r--r--spec/unit/knife/node_list_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb4
-rw-r--r--spec/unit/knife/role_list_spec.rb2
-rw-r--r--spec/unit/knife/tag_delete_spec.rb2
-rw-r--r--spec/unit/knife/user_create_spec.rb10
18 files changed, 35 insertions, 35 deletions
diff --git a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
index 61aa9d0ae1..734b27216d 100644
--- a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
+++ b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
@@ -69,14 +69,14 @@ describe Chef::Knife::Bootstrap::ChefVaultHandler do
end
it "sets two items as an array" do
- knife_config[:bootstrap_vault_item] = { "vault" => %w(item1 item2) }
+ knife_config[:bootstrap_vault_item] = { "vault" => %w{item1 item2} }
expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two vaults from different hash keys" do
- knife_config[:bootstrap_vault_item] = { "vault" => %w(item1 item2), "vault2" => [ "item3" ] }
+ knife_config[:bootstrap_vault_item] = { "vault" => %w{item1 item2}, "vault2" => [ "item3" ] }
expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault2", "item3").and_return(bootstrap_vault_item)
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 357fee3867..3425b94c76 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -51,7 +51,7 @@ describe Chef::Knife::Bootstrap do
context "with --bootstrap-vault-item" do
let(:bootstrap_cli_options) { [ "--bootstrap-vault-item", "vault1:item1", "--bootstrap-vault-item", "vault1:item2", "--bootstrap-vault-item", "vault2:item1" ] }
it "sets the knife config cli option correctly" do
- expect(knife.config[:bootstrap_vault_item]).to eq({ "vault1" => %w(item1 item2), "vault2" => ["item1"] })
+ expect(knife.config[:bootstrap_vault_item]).to eq({ "vault1" => %w{item1 item2}, "vault2" => ["item1"] })
end
end
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index 44a47d8c37..991abea776 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -119,7 +119,7 @@ describe Chef::Knife::CookbookDownload do
it "should download the cookbook when the cookbook download directory doesn't exist" do
expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
@knife.run
- %w(attributes recipes templates).each do |segment|
+ %w{attributes recipes templates}.each do |segment|
expect(@stderr.string).to match /downloading #{segment}/im
end
expect(@stderr.string).to match /downloading foobar cookbook version 1\.0\.0/im
diff --git a/spec/unit/knife/cookbook_list_spec.rb b/spec/unit/knife/cookbook_list_spec.rb
index ba834e08e2..fce6bc9593 100644
--- a/spec/unit/knife/cookbook_list_spec.rb
+++ b/spec/unit/knife/cookbook_list_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::CookbookList do
@knife = Chef::Knife::CookbookList.new
@rest_mock = double("rest")
allow(@knife).to receive(:rest).and_return(@rest_mock)
- @cookbook_names = %w(apache2 mysql)
+ @cookbook_names = %w{apache2 mysql}
@base_url = "https://server.example.com/cookbooks"
@cookbook_data = {}
@cookbook_names.each do |item|
diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb
index 990e9ae098..d60443d779 100644
--- a/spec/unit/knife/cookbook_site_install_spec.rb
+++ b/spec/unit/knife/cookbook_site_install_spec.rb
@@ -71,7 +71,7 @@ describe Chef::Knife::CookbookSiteInstall do
end
it "raises an error if more than two arguments are given" do
- knife.name_args = %w(foo bar baz)
+ knife.name_args = %w{foo bar baz}
expect(knife.ui).to receive(:error).with("Installing multiple cookbooks at once is not supported.")
expect { knife.run }.to raise_error(SystemExit)
end
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index 4b0f82d417..d5e3915896 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Knife::CookbookSiteShare do
@knife = Chef::Knife::CookbookSiteShare.new
# Merge default settings in.
@knife.merge_configs
- @knife.name_args = %w(cookbook_name AwesomeSausage)
+ @knife.name_args = %w{cookbook_name AwesomeSausage}
@cookbook = Chef::CookbookVersion.new("cookbook_name")
diff --git a/spec/unit/knife/cookbook_test_spec.rb b/spec/unit/knife/cookbook_test_spec.rb
index 7f009f99d2..f8b212e271 100644
--- a/spec/unit/knife/cookbook_test_spec.rb
+++ b/spec/unit/knife/cookbook_test_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Knife::CookbookTest do
it "should test multiple cookbooks when provided" do
allow(@knife).to receive(:test_cookbook).and_return(true)
- @knife.name_args = %w(tats jimmy_johns)
+ @knife.name_args = %w{tats jimmy_johns}
expect(@knife).to receive(:test_cookbook).with("tats")
expect(@knife).to receive(:test_cookbook).with("jimmy_johns")
expect(@knife).not_to receive(:test_cookbook).with("central_market")
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index eb2b1f9856..277da14011 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -96,7 +96,7 @@ describe Chef::Knife::CookbookUpload do
describe "when specifying the same cookbook name twice" do
it "should upload the cookbook only once" do
- knife.name_args = %w(test_cookbook test_cookbook)
+ knife.name_args = %w{test_cookbook test_cookbook}
expect(knife).to receive(:upload).once
knife.run
end
@@ -181,7 +181,7 @@ E
it "should upload all dependencies once" do
knife.config[:depends] = true
- allow(knife).to receive(:cookbook_names).and_return(%w(test_cookbook1 test_cookbook2 test_cookbook3))
+ allow(knife).to receive(:cookbook_names).and_return(%w{test_cookbook1 test_cookbook2 test_cookbook3})
expect(knife).to receive(:upload).exactly(3).times
expect do
Timeout.timeout(5) do
@@ -200,7 +200,7 @@ E
{ "test_cookbook" => cookbook,
"dependency" => cookbook_dependency }[ckbk]
end
- allow(knife).to receive(:cookbook_names).and_return(%w(cookbook_dependency test_cookbook))
+ allow(knife).to receive(:cookbook_names).and_return(%w{cookbook_dependency test_cookbook})
@stdout, @stderr, @stdin = StringIO.new, StringIO.new, StringIO.new
knife.ui = Chef::Knife::UI.new(@stdout, @stderr, @stdin, {})
end
@@ -227,7 +227,7 @@ E
"dependency" => cookbook_dependency,
"dependency2" => cookbook_dependency2 }[ckbk]
end
- allow(knife).to receive(:cookbook_names).and_return(%w(dependency dependency2 test_cookbook))
+ allow(knife).to receive(:cookbook_names).and_return(%w{dependency dependency2 test_cookbook})
expect { knife.run }.to raise_error(SystemExit)
expect(@stderr.string).to include("Cookbook test_cookbook depends on cookbooks which are not currently")
expect(@stderr.string).to include("being uploaded and cannot be found on the server.")
@@ -253,7 +253,7 @@ E
@test_cookbook1 = Chef::CookbookVersion.new("test_cookbook1", "/tmp/blah")
@test_cookbook2 = Chef::CookbookVersion.new("test_cookbook2", "/tmp/blah")
allow(cookbook_loader).to receive(:each).and_yield("test_cookbook1", @test_cookbook1).and_yield("test_cookbook2", @test_cookbook2)
- allow(cookbook_loader).to receive(:cookbook_names).and_return(%w(test_cookbook1 test_cookbook2))
+ allow(cookbook_loader).to receive(:cookbook_names).and_return(%w{test_cookbook1 test_cookbook2})
end
it "should upload all cookbooks" do
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index 5c4a33b7e0..4ae046cc09 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -83,7 +83,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
end
it "finds the right subcommand even when _'s are elided" do
- expect(loader.subcommand_for_args(%w(cooler b))).to eq("cooler_b")
+ expect(loader.subcommand_for_args(%w{cooler b})).to eq("cooler_b")
end
it "returns nil if the the subcommand isn't in our manifest" do
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index b5e4aefab6..37974821d7 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -205,7 +205,7 @@ EOM
end
it "formats arrays appropriately" do
- @ui.output(%w(a b))
+ @ui.output(%w{a b})
expect(@out.string).to eq <<EOM
a
b
@@ -228,7 +228,7 @@ EOM
end
it "formats nested arrays appropriately" do
- @ui.output([ %w(a b), %w(c d)])
+ @ui.output([ %w{a b}, %w{c d}])
expect(@out.string).to eq <<EOM
a
b
@@ -239,7 +239,7 @@ EOM
end
it "formats nested arrays with single- and empty subarrays appropriately" do
- @ui.output([ %w(a b), [ "c" ], [], %w(d e)])
+ @ui.output([ %w{a b}, [ "c" ], [], %w{d e}])
expect(@out.string).to eq <<EOM
a
b
@@ -282,7 +282,7 @@ EOM
end
it "formats hashes with array members appropriately" do
- @ui.output({ "a" => %w(foo bar), "b" => "c" })
+ @ui.output({ "a" => %w{foo bar}, "b" => "c" })
expect(@out.string).to eq <<EOM
a:
foo
@@ -301,7 +301,7 @@ EOM
end
it "formats hashes with nested array values appropriately" do
- @ui.output({ "a" => [ %w(foo bar), %w(baz bjork) ], "b" => "c" })
+ @ui.output({ "a" => [ %w{foo bar}, %w{baz bjork} ], "b" => "c" })
# XXX: using a HEREDOC at this point results in a line with required spaces which auto-whitespace removal settings
# on editors will remove and will break this test.
expect(@out.string).to eq("a:\n foo\n bar\n \n baz\n bjork\nb: c\n")
@@ -353,7 +353,7 @@ EOM
it "should return multiple attributes" do
input = { "gi" => "go", "hi" => "ho", "id" => "sample-data-bag-item" }
- @ui.config[:attribute] = %w(gi hi)
+ @ui.config[:attribute] = %w{gi hi}
expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { "gi" => "go", "hi" => "ho" } })
end
@@ -545,7 +545,7 @@ EOM
end
end
- %w(Y y).each do |answer|
+ %w{Y y}.each do |answer|
describe "with answer #{answer}" do
let(:answer) { answer }
@@ -553,7 +553,7 @@ EOM
end
end
- %w(N n).each do |answer|
+ %w{N n}.each do |answer|
describe "with answer #{answer}" do
let(:answer) { answer }
diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb
index 9d9a61a32f..863cdd4e6e 100644
--- a/spec/unit/knife/environment_compare_spec.rb
+++ b/spec/unit/knife/environment_compare_spec.rb
@@ -42,7 +42,7 @@ describe Chef::Knife::EnvironmentCompare do
@rest_double = double("rest")
allow(@knife).to receive(:rest).and_return(@rest_double)
- @cookbook_names = %w(apache2 mysql foo bar dummy chef_handler)
+ @cookbook_names = %w{apache2 mysql foo bar dummy chef_handler}
@base_url = "https://server.example.com/cookbooks"
@cookbook_data = {}
@cookbook_names.each do |item|
diff --git a/spec/unit/knife/node_environment_set_spec.rb b/spec/unit/knife/node_environment_set_spec.rb
index ea4112fe87..03fc764fd8 100644
--- a/spec/unit/knife/node_environment_set_spec.rb
+++ b/spec/unit/knife/node_environment_set_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Knife::NodeEnvironmentSet do
before(:each) do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeEnvironmentSet.new
- @knife.name_args = %w(adam bar)
+ @knife.name_args = %w{adam bar}
allow(@knife).to receive(:output).and_return(true)
@node = Chef::Node.new()
@node.name("knifetest-node")
diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb
index fbbe6bee06..b94101ef7a 100644
--- a/spec/unit/knife/node_list_spec.rb
+++ b/spec/unit/knife/node_list_spec.rb
@@ -40,7 +40,7 @@ describe Chef::Knife::NodeList do
it "should pretty print the list" do
expect(Chef::Node).to receive(:list).and_return(@list)
- expect(@knife).to receive(:output).with(%w(bar foo))
+ expect(@knife).to receive(:output).with(%w{bar foo})
@knife.run
end
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index c5c7696091..4f753d7991 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -96,7 +96,7 @@ describe Chef::Knife::NodeRunListRemove do
it "should warn even more when the thing to remove is not in the runlist and unqualified" do
@node.run_list << "role[blah]"
@node.run_list << "recipe[duck::type]"
- @knife.name_args = %w(adam blork)
+ @knife.name_args = %w{adam blork}
expect(@knife.ui).to receive(:warn).with("blork is not in the run list")
expect(@knife.ui).to receive(:warn).with(/did you forget recipe\[\] or role\[\]/)
@knife.run
diff --git a/spec/unit/knife/role_env_run_list_clear_spec.rb b/spec/unit/knife/role_env_run_list_clear_spec.rb
index b843394c29..b7af9b7d57 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Knife::RoleEnvRunListClear do
@knife.config = {
:print_after => nil
}
- @knife.name_args = %w(will QA)
+ @knife.name_args = %w{will QA}
allow(@knife).to receive(:output).and_return(true)
@role = Chef::Role.new()
@@ -79,7 +79,7 @@ describe Chef::Knife::RoleEnvRunListClear do
@setup.run
@setup.name_args = [ "will", "PRD", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = %w(will QA)
+ @knife.name_args = %w{will QA}
@knife.run
expect(@role.run_list_for("QA")[0]).to be_nil
expect(@role.run_list_for("PRD")[0]).to eq("recipe[orange::chicken]")
diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb
index b244039520..30743fdc02 100644
--- a/spec/unit/knife/role_list_spec.rb
+++ b/spec/unit/knife/role_list_spec.rb
@@ -38,7 +38,7 @@ describe Chef::Knife::RoleList do
it "should pretty print the list" do
expect(Chef::Role).to receive(:list).and_return(@list)
- expect(@knife).to receive(:output).with(%w(bar foo))
+ expect(@knife).to receive(:output).with(%w{bar foo})
@knife.run
end
diff --git a/spec/unit/knife/tag_delete_spec.rb b/spec/unit/knife/tag_delete_spec.rb
index 43f06de23f..5c932706af 100644
--- a/spec/unit/knife/tag_delete_spec.rb
+++ b/spec/unit/knife/tag_delete_spec.rb
@@ -16,7 +16,7 @@ describe Chef::Knife::TagDelete do
describe "run" do
it "can delete tags on a node" do
- expect(@node.tags).to eq(%w(sadtag happytag))
+ expect(@node.tags).to eq(%w{sadtag happytag})
@knife.run
expect(@node.tags).to eq(["happytag"])
expect(@stderr.string).to match /deleted.+sadtag/i
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index 1a5a394912..806e8cf400 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -79,7 +79,7 @@ describe Chef::Knife::UserCreate do
context "when FIRST_NAME isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { %w(some_user some_display_name) }
+ let(:name_args) { %w{some_user some_display_name} }
let(:fieldname) { "first name" }
end
end
@@ -87,7 +87,7 @@ describe Chef::Knife::UserCreate do
context "when LAST_NAME isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { %w(some_user some_display_name some_first_name) }
+ let(:name_args) { %w{some_user some_display_name some_first_name} }
let(:fieldname) { "last name" }
end
end
@@ -95,7 +95,7 @@ describe Chef::Knife::UserCreate do
context "when EMAIL isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { %w(some_user some_display_name some_first_name some_last_name) }
+ let(:name_args) { %w{some_user some_display_name some_first_name some_last_name} }
let(:fieldname) { "email" }
end
end
@@ -103,14 +103,14 @@ describe Chef::Knife::UserCreate do
context "when PASSWORD isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { %w(some_user some_display_name some_first_name some_last_name some_email) }
+ let(:name_args) { %w{some_user some_display_name some_first_name some_last_name some_email} }
let(:fieldname) { "password" }
end
end
context "when all mandatory fields are validly specified" do
before do
- knife.name_args = %w(some_user some_display_name some_first_name some_last_name some_email some_password)
+ knife.name_args = %w{some_user some_display_name some_first_name some_last_name some_email some_password}
allow(knife).to receive(:edit_data).and_return(knife.user.to_hash)
allow(knife).to receive(:create_user_from_hash).and_return(knife.user)
end