summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/client/client_spec.rb4
-rw-r--r--spec/integration/client/exit_code_spec.rb6
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb66
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb12
-rw-r--r--spec/integration/knife/chefignore_spec.rb2
-rw-r--r--spec/integration/knife/client_create_spec.rb2
-rw-r--r--spec/integration/knife/client_key_create_spec.rb2
-rw-r--r--spec/integration/knife/common_options_spec.rb6
-rw-r--r--spec/integration/knife/config_get_profile_spec.rb4
-rw-r--r--spec/integration/knife/config_get_spec.rb22
-rw-r--r--spec/integration/knife/config_list_profiles_spec.rb16
-rw-r--r--spec/integration/knife/config_use_profile_spec.rb6
-rw-r--r--spec/integration/knife/delete_spec.rb8
-rw-r--r--spec/integration/knife/deps_spec.rb22
-rw-r--r--spec/integration/knife/diff_spec.rb24
-rw-r--r--spec/integration/knife/list_spec.rb18
-rw-r--r--spec/integration/knife/redirection_spec.rb2
-rw-r--r--spec/integration/knife/show_spec.rb2
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb10
-rw-r--r--spec/integration/recipes/noop_resource_spec.rb4
-rw-r--r--spec/integration/recipes/provider_choice.rb4
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb318
-rw-r--r--spec/integration/recipes/resource_action_spec.rb26
-rw-r--r--spec/integration/recipes/resource_converge_if_changed_spec.rb6
-rw-r--r--spec/integration/recipes/resource_load_spec.rb18
-rw-r--r--spec/integration/solo/solo_spec.rb4
26 files changed, 307 insertions, 307 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 68cfd015ab..a6930e8231 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -48,7 +48,7 @@ describe "chef-client" do
let(:chef_solo) { "bundle exec #{Chef::Dist::SOLOEXEC} --legacy-mode --minimal-ohai" }
when_the_repository "has a cookbook with a no-op recipe" do
- before { file "cookbooks/x/recipes/default.rb", "" }
+ before do file "cookbooks/x/recipes/default.rb", "" end
it "should complete with success" do
file "config/client.rb", <<~EOM
@@ -93,7 +93,7 @@ describe "chef-client" do
end
context "and a config file under .chef/knife.rb" do
- before { file ".chef/knife.rb", "xxx.xxx" }
+ before do file ".chef/knife.rb", "xxx.xxx" end
it "should load .chef/knife.rb when -z is specified" do
result = shell_out("#{chef_client} -z -o 'x::default'", cwd: path_to(""))
diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb
index 37999ab431..18f44a3e34 100644
--- a/spec/integration/client/exit_code_spec.rb
+++ b/spec/integration/client/exit_code_spec.rb
@@ -57,7 +57,7 @@ describe "chef-client" do
context "with a recipe" do
context "which throws an error" do
- before { file "cookbooks/x/recipes/default.rb", "raise 'BOOM'" }
+ before do file "cookbooks/x/recipes/default.rb", "raise 'BOOM'" end
it "exits with GENERIC_FAILURE, 1" do
setup_client_rb
@@ -66,7 +66,7 @@ describe "chef-client" do
end
context "with a recipe which calls Chef::Application.fatal with a non-RFC exit code" do
- before { file "cookbooks/x/recipes/default.rb", "Chef::Application.fatal!('BOOM', 123)" }
+ before do file "cookbooks/x/recipes/default.rb", "Chef::Application.fatal!('BOOM', 123)" end
it "exits with the GENERIC_FAILURE exit code, 1" do
setup_client_rb
@@ -75,7 +75,7 @@ describe "chef-client" do
end
context "with a recipe which calls Chef::Application.exit with a non-RFC exit code" do
- before { file "cookbooks/x/recipes/default.rb", "Chef::Application.exit!('BOOM', 231)" }
+ before do file "cookbooks/x/recipes/default.rb", "Chef::Application.exit!('BOOM', 231)" end
it "exits with the GENERIC_FAILURE exit code, 1" do
setup_client_rb
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index 919741f930..852438d4db 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -178,21 +178,21 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -216,7 +216,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside data_bags2" do
- before { cwd "data_bags2" }
+ before do cwd "data_bags2" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag2/
@@ -237,7 +237,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -261,21 +261,21 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside data_bags2" do
- before { cwd "data_bags2" }
+ before do cwd "data_bags2" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag2/
@@ -294,21 +294,21 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -332,7 +332,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2/data_bags" do
- before { cwd "chef_repo2/data_bags" }
+ before do cwd "chef_repo2/data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag3/
@@ -514,14 +514,14 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -533,7 +533,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -566,7 +566,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside data_bags2" do
- before { cwd "data_bags2" }
+ before do cwd "data_bags2" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -590,7 +590,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -623,7 +623,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -635,7 +635,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -668,7 +668,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2/data_bags" do
- before { cwd "chef_repo2/data_bags" }
+ before do cwd "chef_repo2/data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -690,21 +690,21 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -728,7 +728,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2/data_bags" do
- before { cwd "chef_repo2/data_bags" }
+ before do cwd "chef_repo2/data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag3/
@@ -751,7 +751,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -784,7 +784,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -796,7 +796,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -829,7 +829,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2/data_bags" do
- before { cwd "chef_repo2/data_bags" }
+ before do cwd "chef_repo2/data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -851,14 +851,14 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
@@ -868,7 +868,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2" do
- before { cwd "chef_repo2" }
+ before do cwd "chef_repo2" end
it "knife list --local -Rfp lists everything" do
knife("list --local -Rfp").should_succeed <<~EOM
clients/
@@ -892,7 +892,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside chef_repo2/data_bags" do
- before { cwd "chef_repo2/data_bags" }
+ before do cwd "chef_repo2/data_bags" end
it "knife list --local -Rfp fails" do
knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
@@ -926,7 +926,7 @@ describe "chef_repo_path tests", :workstation do
end
context "when cwd is inside the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife list --local -Rfp lists data bags" do
knife("list --local -Rfp").should_succeed <<~EOM
bag/
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index 6e9c4611e2..04584e1fb4 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -42,7 +42,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has an empty data_bags directory" do
- before { directory "data_bags" }
+ before do directory "data_bags" end
it "knife list --local / returns it" do
knife("list --local /").should_succeed "/data_bags\n"
@@ -50,7 +50,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has an empty cookbook directory" do
- before { directory "cookbooks/cookbook1" }
+ before do directory "cookbooks/cookbook1" end
it "knife list --local -Rfp / does not return it" do
knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
@@ -60,7 +60,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has only empty cookbook subdirectories" do
- before { directory "cookbooks/cookbook1/recipes" }
+ before do directory "cookbooks/cookbook1/recipes" end
it "knife list --local -Rfp / does not return it" do
knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
@@ -87,7 +87,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has only empty cookbook sub-sub-directories" do
- before { directory "cookbooks/cookbook1/templates/default" }
+ before do directory "cookbooks/cookbook1/templates/default" end
it "knife list --local -Rfp / does not return it" do
knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
@@ -159,7 +159,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has a file in cookbooks/" do
- before { file "cookbooks/file", "" }
+ before do file "cookbooks/file", "" end
it "does not show up in list -Rfp" do
knife("list --local -Rfp /").should_succeed <<~EOM
/cookbooks/
@@ -168,7 +168,7 @@ describe "General chef_repo file system checks", :workstation do
end
when_the_repository "has a file in data_bags/" do
- before { file "data_bags/file", "" }
+ before do file "data_bags/file", "" end
it "does not show up in list -Rfp" do
knife("list --local -Rfp /").should_succeed <<~EOM
/data_bags/
diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb
index b92fb1f485..b022f1a842 100644
--- a/spec/integration/knife/chefignore_spec.rb
+++ b/spec/integration/knife/chefignore_spec.rb
@@ -84,7 +84,7 @@ describe "chefignore tests", :workstation do
end
context "and has a chefignore with filenames" do
- before { file "cookbooks/chefignore", "x.json\n" }
+ before do file "cookbooks/chefignore", "x.json\n" end
it "matching files and directories get ignored in all cookbooks" do
knife("list --local -Rfp /").should_succeed <<~EOM
diff --git a/spec/integration/knife/client_create_spec.rb b/spec/integration/knife/client_create_spec.rb
index 505358923b..2a5420cc46 100644
--- a/spec/integration/knife/client_create_spec.rb
+++ b/spec/integration/knife/client_create_spec.rb
@@ -57,7 +57,7 @@ describe "knife client create", :workstation do
it "reads the public key from a file" do
Dir.mktmpdir do |tgt|
key = OpenSSL::PKey::RSA.generate(1024)
- File.open("#{tgt}/public.pem", "w") { |pub| pub.write(key.public_key.to_pem) }
+ File.open("#{tgt}/public.pem", "w") do |pub| pub.write(key.public_key.to_pem) end
knife("client create -p #{tgt}/public.pem bah").should_succeed stderr: out
end
end
diff --git a/spec/integration/knife/client_key_create_spec.rb b/spec/integration/knife/client_key_create_spec.rb
index 7ccec8bffd..dc3fbd236d 100644
--- a/spec/integration/knife/client_key_create_spec.rb
+++ b/spec/integration/knife/client_key_create_spec.rb
@@ -56,7 +56,7 @@ describe "knife client key create", :workstation do
it "reads the public key from a file" do
Dir.mktmpdir do |tgt|
key = OpenSSL::PKey::RSA.generate(1024)
- File.open("#{tgt}/public.pem", "w") { |pub| pub.write(key.public_key.to_pem) }
+ File.open("#{tgt}/public.pem", "w") do |pub| pub.write(key.public_key.to_pem) end
knife("client key create -p #{tgt}/public.pem -k new bah").should_succeed stderr: /^#{out}/
end
end
diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb
index 5eac571a85..d92c51955b 100644
--- a/spec/integration/knife/common_options_spec.rb
+++ b/spec/integration/knife/common_options_spec.rb
@@ -31,7 +31,7 @@ describe "knife common options", :workstation do
let(:local_listen_warning) { /\Awarn:.*local.*listen.*$/im }
when_the_repository "has a node" do
- before { file "nodes/x.json", {} }
+ before do file "nodes/x.json", {} end
context "When chef_zero.enabled is true" do
before(:each) do
@@ -48,7 +48,7 @@ describe "knife common options", :workstation do
end
context "And chef_zero.port is 9999" do
- before(:each) { Chef::Config.chef_zero.port = 9999 }
+ before(:each) do Chef::Config.chef_zero.port = 9999 end
it "knife raw /nodes/x should retrieve the node" do
knife("raw --listen /nodes/x").should_succeed( /"name": "x"/, stderr: local_listen_warning )
@@ -58,7 +58,7 @@ describe "knife common options", :workstation do
# 0.0.0.0 is not a valid address to bind to on windows.
context "And chef_zero.host is 0.0.0.0", :unix_only do
- before(:each) { Chef::Config.chef_zero.host = "0.0.0.0" }
+ before(:each) do Chef::Config.chef_zero.host = "0.0.0.0" end
it "knife raw /nodes/x should retrieve the role" do
knife("raw --listen /nodes/x").should_succeed( /"name": "x"/, stderr: local_listen_warning )
diff --git a/spec/integration/knife/config_get_profile_spec.rb b/spec/integration/knife/config_get_profile_spec.rb
index e97b24b869..214413f548 100644
--- a/spec/integration/knife/config_get_profile_spec.rb
+++ b/spec/integration/knife/config_get_profile_spec.rb
@@ -41,7 +41,7 @@ describe "knife config get-profile", :workstation do
old_wd = Dir.pwd
ChefConfig::PathHelper.per_tool_home_environment = "KNIFE_HOME"
# Clear these out because they are cached permanently.
- ChefConfig::PathHelper.class_exec { remove_class_variable(:@@home_dir) }
+ ChefConfig::PathHelper.class_exec do remove_class_variable(:@@home_dir) end
Chef::Knife::ConfigGetProfile.reset_config_loader!
begin
ex.run
@@ -88,7 +88,7 @@ describe "knife config get-profile", :workstation do
end
context "with a context file" do
- before { file(".chef/context", "development\n") }
+ before do file(".chef/context", "development\n") end
it { is_expected.to eq "development\n" }
end
diff --git a/spec/integration/knife/config_get_spec.rb b/spec/integration/knife/config_get_spec.rb
index 98fefd729f..d2e1461a2a 100644
--- a/spec/integration/knife/config_get_spec.rb
+++ b/spec/integration/knife/config_get_spec.rb
@@ -45,7 +45,7 @@ describe "knife config get", :workstation do
old_wd = Dir.pwd
ChefConfig::PathHelper.per_tool_home_environment = "KNIFE_HOME"
# Clear these out because they are cached permanently.
- ChefConfig::PathHelper.class_exec { remove_class_variable(:@@home_dir) }
+ ChefConfig::PathHelper.class_exec do remove_class_variable(:@@home_dir) end
Chef::Knife::ConfigGet.reset_config_loader!
begin
ex.run
@@ -69,14 +69,14 @@ describe "knife config get", :workstation do
end
context "with a global knife.rb" do
- before { file(".chef/knife.rb", "node_name 'one'\n") }
+ before do file(".chef/knife.rb", "node_name 'one'\n") end
it { is_expected.to match(%r{^Loading from configuration file .*/#{File.basename(path_to("."))}/.chef/knife.rb$}) }
it { is_expected.to match(/^node_name:\s+one$/) }
end
context "with a repo knife.rb" do
- before { file("repo/.chef/knife.rb", "node_name 'two'\n") }
+ before do file("repo/.chef/knife.rb", "node_name 'two'\n") end
it { is_expected.to match(%r{^Loading from configuration file .*/#{File.basename(path_to("."))}/repo/.chef/knife.rb$}) }
it { is_expected.to match(/^node_name:\s+two$/) }
@@ -93,7 +93,7 @@ describe "knife config get", :workstation do
end
context "with a credentials file" do
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { is_expected.to match(%r{^Loading from credentials file .*/#{File.basename(path_to("."))}/.chef/credentials$}) }
it { is_expected.to match(/^node_name:\s+three$/) }
@@ -134,49 +134,49 @@ describe "knife config get", :workstation do
context "with single argument" do
let(:cmd_args) { %w{node_name} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { is_expected.to match(/^node_name:\s+three\Z/) }
end
context "with two arguments" do
let(:cmd_args) { %w{node_name client_key} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\nclient_key = \"three.pem\"") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\nclient_key = \"three.pem\"") end
it { is_expected.to match(%r{^client_key:\s+\S*/.chef/three.pem\nnode_name:\s+three\Z}) }
end
context "with a dotted argument" do
let(:cmd_args) { %w{knife.ssh_user} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n[default.knife]\nssh_user = \"foo\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n[default.knife]\nssh_user = \"foo\"\n") end
it { is_expected.to match(/^knife.ssh_user:\s+foo\Z/) }
end
context "with regex argument" do
let(:cmd_args) { %w{/name/} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { is_expected.to match(/^node_name:\s+three\Z/) }
end
context "with --all" do
let(:cmd_args) { %w{-a /key_contents/} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { is_expected.to match(/^client_key_contents:\s+\nvalidation_key_contents:\s+\Z/) }
end
context "with --raw" do
let(:cmd_args) { %w{-r node_name} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { is_expected.to eq("three\n") }
end
context "with --format=json" do
let(:cmd_args) { %w{--format=json node_name} }
- before { file(".chef/credentials", "[default]\nclient_name = \"three\"\n") }
+ before do file(".chef/credentials", "[default]\nclient_name = \"three\"\n") end
it { expect(JSON.parse(subject)).to eq({ "node_name" => "three" }) }
end
diff --git a/spec/integration/knife/config_list_profiles_spec.rb b/spec/integration/knife/config_list_profiles_spec.rb
index 044b50b5be..3f7dd33c9c 100644
--- a/spec/integration/knife/config_list_profiles_spec.rb
+++ b/spec/integration/knife/config_list_profiles_spec.rb
@@ -37,7 +37,7 @@ describe "knife config list-profiles", :workstation do
old_home = ENV["HOME"]
old_wd = Dir.pwd
# Clear these out because they are cached permanently.
- ChefConfig::PathHelper.class_exec { remove_class_variable(:@@home_dir) }
+ ChefConfig::PathHelper.class_exec do remove_class_variable(:@@home_dir) end
Chef::Knife::ConfigListProfiles.reset_config_loader!
begin
ex.run
@@ -67,13 +67,13 @@ describe "knife config list-profiles", :workstation do
end
context "with an empty credentials file" do
- before { file(".chef/credentials", "") }
+ before do file(".chef/credentials", "") end
subject { knife_list_profiles.stderr }
it { is_expected.to eq "FATAL: No profiles found, #{path_to(".chef/credentials")} does not exist or is empty\n" }
end
context "with a simple default profile" do
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
client_name = "testuser"
client_key = "testkey.pem"
@@ -87,7 +87,7 @@ describe "knife config list-profiles", :workstation do
end
context "with multiple profiles" do
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
client_name = "testuser"
client_key = "testkey.pem"
@@ -114,7 +114,7 @@ describe "knife config list-profiles", :workstation do
context "with a non-default active profile" do
let(:cmd_args) { %w{--profile prod} }
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
client_name = "testuser"
client_key = "testkey.pem"
@@ -140,7 +140,7 @@ describe "knife config list-profiles", :workstation do
end
context "with a minimal profile" do
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
chef_server_url = "https://example.com/organizations/testorg"
EOH
@@ -149,7 +149,7 @@ describe "knife config list-profiles", :workstation do
context "with -i" do
let(:cmd_args) { %w{-i} }
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
chef_server_url = "https://example.com/organizations/testorg"
EOH
@@ -162,7 +162,7 @@ describe "knife config list-profiles", :workstation do
context "with --format=json" do
let(:cmd_args) { %w{--format=json node_name} }
- before { file(".chef/credentials", <<~EOH) }
+ before do file(".chef/credentials", <<~EOH) end
[default]
client_name = "testuser"
client_key = "testkey.pem"
diff --git a/spec/integration/knife/config_use_profile_spec.rb b/spec/integration/knife/config_use_profile_spec.rb
index a021dbbe6f..4c52d1c4bd 100644
--- a/spec/integration/knife/config_use_profile_spec.rb
+++ b/spec/integration/knife/config_use_profile_spec.rb
@@ -42,7 +42,7 @@ describe "knife config use-profile", :workstation do
old_wd = Dir.pwd
ChefConfig::PathHelper.per_tool_home_environment = "KNIFE_HOME"
# Clear these out because they are cached permanently.
- ChefConfig::PathHelper.class_exec { remove_class_variable(:@@home_dir) }
+ ChefConfig::PathHelper.class_exec do remove_class_variable(:@@home_dir) end
Chef::Knife::ConfigUseProfile.reset_config_loader!
begin
ex.run
@@ -80,7 +80,7 @@ describe "knife config use-profile", :workstation do
context "with $CHEF_HOME" do
let(:cmd_args) { %w{staging} }
- before { ENV["CHEF_HOME"] = path_to("chefhome"); file("chefhome/tmp", "") }
+ before do ENV["CHEF_HOME"] = path_to("chefhome"); file("chefhome/tmp", "") end
it do
is_expected.to eq "Set default profile to staging\n"
expect(File.read(path_to("chefhome/.chef/context"))).to eq "staging\n"
@@ -90,7 +90,7 @@ describe "knife config use-profile", :workstation do
context "with $KNIFE_HOME" do
let(:cmd_args) { %w{development} }
- before { ENV["KNIFE_HOME"] = path_to("knifehome"); file("knifehome/tmp", "") }
+ before do ENV["KNIFE_HOME"] = path_to("knifehome"); file("knifehome/tmp", "") end
it do
is_expected.to eq "Set default profile to development\n"
expect(File.read(path_to("knifehome/.chef/context"))).to eq "development\n"
diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb
index fd5853dfef..440be05878 100644
--- a/spec/integration/knife/delete_spec.rb
+++ b/spec/integration/knife/delete_spec.rb
@@ -641,7 +641,7 @@ describe "knife delete", :workstation do
end
context "and cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife delete fails" do
knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/
knife("list -Rf /").should_succeed <<~EOM
@@ -854,7 +854,7 @@ describe "knife delete", :workstation do
end
context "and cwd is at the top level" do
- before { cwd "." }
+ before do cwd "." end
it "knife delete fails" do
knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/
knife("list -Rf /").should_succeed <<~EOM
@@ -928,7 +928,7 @@ describe "knife delete", :workstation do
end
when_the_chef_server "has a later version for the cookbook, and no current version" do
- before { cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" } }
+ before do cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" } end
it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
@@ -938,7 +938,7 @@ describe "knife delete", :workstation do
end
when_the_chef_server "has an earlier version for the cookbook, and no current version" do
- before { cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } }
+ before do cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } end
it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 4dfccf38de..0c0e441966 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -25,7 +25,7 @@ describe "knife deps", :workstation do
context "local" do
when_the_repository "has a role with no run_list" do
- before { file "roles/starring.json", {} }
+ before do file "roles/starring.json", {} end
it "knife deps reports no dependencies" do
knife("deps /roles/starring.json").should_succeed "/roles/starring.json\n"
end
@@ -70,7 +70,7 @@ describe "knife deps", :workstation do
end
when_the_repository "has a node with no environment or run_list" do
- before { file "nodes/mort.json", {} }
+ before do file "nodes/mort.json", {} end
it "knife deps reports just the node" do
knife("deps /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
@@ -123,13 +123,13 @@ depends "kettle"'
end
end
when_the_repository "has a data bag" do
- before { file "data_bags/bag/item.json", {} }
+ before do file "data_bags/bag/item.json", {} end
it "knife deps reports just the data bag" do
knife("deps /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
when_the_repository "has an environment" do
- before { file "environments/desert.json", {} }
+ before do file "environments/desert.json", {} end
it "knife deps reports just the environment" do
knife("deps /environments/desert.json").should_succeed "/environments/desert.json\n"
end
@@ -344,13 +344,13 @@ depends "foo"'
end
end
when_the_repository "has a data bag" do
- before { file "data_bags/bag/item.json", "" }
+ before do file "data_bags/bag/item.json", "" end
it "knife deps /data_bags/bag shows no dependencies" do
knife("deps /data_bags/bag").should_succeed("/data_bags/bag\n")
end
end
when_the_repository "has a cookbook" do
- before { file "cookbooks/blah/metadata.rb", 'name "blah"' }
+ before do file "cookbooks/blah/metadata.rb", 'name "blah"' end
it "knife deps on a cookbook file shows no dependencies" do
knife("deps /cookbooks/blah/metadata.rb").should_succeed(
"/cookbooks/blah/metadata.rb\n"
@@ -364,7 +364,7 @@ depends "foo"'
include_context "default config options"
when_the_chef_server "has a role with no run_list" do
- before { role "starring", {} }
+ before do role "starring", {} end
it "knife deps reports no dependencies" do
knife("deps --remote /roles/starring.json").should_succeed "/roles/starring.json\n"
end
@@ -405,7 +405,7 @@ depends "foo"'
end
when_the_chef_server "has a node with no environment or run_list" do
- before { node "mort", {} }
+ before do node "mort", {} end
it "knife deps reports just the node" do
knife("deps --remote /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
@@ -454,13 +454,13 @@ depends "kettle"', "recipes" => { "default.rb" => "" } }
end
end
when_the_chef_server "has a data bag" do
- before { data_bag "bag", { "item" => {} } }
+ before do data_bag "bag", { "item" => {} } end
it "knife deps reports just the data bag" do
knife("deps --remote /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
when_the_chef_server "has an environment" do
- before { environment "desert", {} }
+ before do environment "desert", {} end
it "knife deps reports just the environment" do
knife("deps --remote /environments/desert.json").should_succeed "/environments/desert.json\n"
end
@@ -678,7 +678,7 @@ depends "self"' }
end
end
when_the_chef_server "has a data bag" do
- before { data_bag "bag", { "item" => {} } }
+ before do data_bag "bag", { "item" => {} } end
it "knife deps /data_bags/bag shows no dependencies" do
knife("deps --remote /data_bags/bag").should_succeed("/data_bags/bag\n")
end
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index 87cbd1559d..944666ccc7 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -134,7 +134,7 @@ describe "knife diff", :workstation do
end
context "when cwd is the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife diff reports different data bags" do
knife("diff --name-status").should_succeed <<~EOM
A\tx/z.json
@@ -240,13 +240,13 @@ describe "knife diff", :workstation do
end
when_the_chef_server "has an empty environment" do
- before { environment "x", {} }
+ before do environment "x", {} end
it "knife diff returns no differences" do
knife("diff /environments/x.json").should_succeed ""
end
end
when_the_chef_server "has an environment with a different value" do
- before { environment "x", { "description" => "hi" } }
+ before do environment "x", { "description" => "hi" } end
it "knife diff reports the difference" do
knife("diff /environments/x.json").should_succeed(/
{
@@ -305,9 +305,9 @@ describe "knife diff", :workstation do
end
when_the_chef_server "has an environment" do
- before { environment "x", {} }
+ before do environment "x", {} end
when_the_repository "has an environment with bad JSON" do
- before { file "environments/x.json", "{" }
+ before do file "environments/x.json", "{" end
it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
@@ -430,7 +430,7 @@ describe "knife diff", :workstation do
end
context "when cwd is the data_bags directory" do
- before { cwd "data_bags" }
+ before do cwd "data_bags" end
it "knife diff reports different data bags" do
knife("diff --name-status").should_succeed <<~EOM
A\tx/z.json
@@ -524,15 +524,15 @@ describe "knife diff", :workstation do
context "json diff tests" do
when_the_repository "has an empty environment file" do
- before { file "environments/x.json", {} }
+ before do file "environments/x.json", {} end
when_the_chef_server "has an empty environment" do
- before { environment "x", {} }
+ before do environment "x", {} end
it "knife diff returns no differences" do
knife("diff /environments/x.json").should_succeed ""
end
end
when_the_chef_server "has an environment with a different value" do
- before { environment "x", { "description" => "hi" } }
+ before do environment "x", { "description" => "hi" } end
it "knife diff reports the difference" do
knife("diff /environments/x.json").should_succeed(/
{
@@ -559,7 +559,7 @@ describe "knife diff", :workstation do
end
end
when_the_chef_server "has an environment with no value" do
- before { environment "x", {} }
+ before do environment "x", {} end
it "knife diff reports the difference" do
knife("diff /environments/x.json").should_succeed(/
{
@@ -588,9 +588,9 @@ describe "knife diff", :workstation do
end
when_the_chef_server "has an environment" do
- before { environment "x", {} }
+ before do environment "x", {} end
when_the_repository "has an environment with bad JSON" do
- before { file "environments/x.json", "{" }
+ before do file "environments/x.json", "{" end
it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to("environments/x.json")} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 830dd0e428..fb62c69ec7 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -314,7 +314,7 @@ describe "knife list", :workstation do
context "symlink tests" do
when_the_repository "is empty" do
context "when cwd is at the top of the repository" do
- before { cwd "." }
+ before do cwd "." end
it "knife list -Rfp returns everything" do
knife("list -Rfp").should_succeed <<~EOM
@@ -357,9 +357,9 @@ describe "knife list", :workstation do
end
when_the_repository "has a cookbooks directory" do
- before { directory "cookbooks" }
+ before do directory "cookbooks" end
context "when cwd is in cookbooks/" do
- before { cwd "cookbooks" }
+ before do cwd "cookbooks" end
it "knife list -Rfp / returns everything" do
knife("list -Rfp /").should_succeed <<~EOM
@@ -451,10 +451,10 @@ describe "knife list", :workstation do
end
when_the_repository "has a cookbooks/cookbook2 directory" do
- before { directory "cookbooks/cookbook2" }
+ before do directory "cookbooks/cookbook2" end
context "when cwd is in cookbooks/cookbook2" do
- before { cwd "cookbooks/cookbook2" }
+ before do cwd "cookbooks/cookbook2" end
it "knife list -Rfp returns cookbooks" do
knife("list -Rfp").should_succeed <<~EOM
@@ -473,7 +473,7 @@ describe "knife list", :workstation do
end
context "when cwd is in cookbooks/" do
- before { cwd "cookbooks" }
+ before do cwd "cookbooks" end
it "knife list -Rfp returns cookbooks" do
knife("list -Rfp").should_succeed <<~EOM
@@ -488,7 +488,7 @@ describe "knife list", :workstation do
end
context "when cwd is in symlinked/" do
- before { cwd "symlinked" }
+ before do cwd "symlinked" end
it "knife list -Rfp returns cookbooks" do
knife("list -Rfp").should_succeed <<~EOM
@@ -510,7 +510,7 @@ describe "knife list", :workstation do
end
context "when cwd is in real_cookbooks/" do
- before { cwd "real_cookbooks" }
+ before do cwd "real_cookbooks" end
it "knife list -Rfp returns cookbooks" do
knife("list -Rfp").should_succeed <<~EOM
@@ -525,7 +525,7 @@ describe "knife list", :workstation do
end
context "when cwd is in cookbooks/" do
- before { cwd "cookbooks" }
+ before do cwd "cookbooks" end
it "knife list -Rfp returns cookbooks" do
knife("list -Rfp").should_succeed <<~EOM
diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb
index 5e5ef27b9a..7bf7b772cd 100644
--- a/spec/integration/knife/redirection_spec.rb
+++ b/spec/integration/knife/redirection_spec.rb
@@ -27,7 +27,7 @@ describe "redirection", :workstation do
include_context "default config options"
when_the_chef_server "has a role" do
- before { role "x", {} }
+ before do role "x", {} end
context "and another server redirects to it with 302" do
before :each do
diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb
index dd83475b8c..a237603ceb 100644
--- a/spec/integration/knife/show_spec.rb
+++ b/spec/integration/knife/show_spec.rb
@@ -156,7 +156,7 @@ describe "knife show", :workstation do
end
when_the_repository "has an environment with bad JSON" do
- before { file "environments/x.json", "{" }
+ before do file "environments/x.json", "{" end
it "knife show succeeds" do
knife("show --local /environments/x.json").should_succeed <<~EOM
/environments/x.json:
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index b96fa1d67d..e732da9f69 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -37,9 +37,9 @@ describe "LWRPs with inline resources" do
it "this is totally a bug, but for backcompat purposes, it adds the resources to the main resource collection and does not get marked updated" do
r = nil
- expect_recipe do
+ expect_recipe {
r = lwrp_inline_resources_test "hi"
- end.to have_updated("ruby_block[run a]", :run)
+ }.to have_updated("ruby_block[run a]", :run)
expect(r.ran_a).to eq "ran a"
end
end
@@ -58,7 +58,7 @@ describe "LWRPs with inline resources" do
end
end
- after { File.delete(LwrpShadowedPropertyTest::PATH) if File.exists?(LwrpShadowedPropertyTest::PATH) }
+ after do File.delete(LwrpShadowedPropertyTest::PATH) if File.exists?(LwrpShadowedPropertyTest::PATH) end
# https://github.com/chef/chef/issues/4334
it "does not warn spuriously" do
@@ -101,11 +101,11 @@ describe "LWRPs with inline resources" do
it "resources declared in b are executed immediately inline" do
r = nil
- expect_recipe do
+ expect_recipe {
r = lwrp_inline_resources_test2 "hi" do
action :b
end
- end.to have_updated("lwrp_inline_resources_test2[hi]", :b)
+ }.to have_updated("lwrp_inline_resources_test2[hi]", :b)
.and have_updated("ruby_block[run a]", :run)
.and have_updated("ruby_block[run b]", :run)
expect(r.ran_b).to eq "ran b: ran_a value was \"ran a\""
diff --git a/spec/integration/recipes/noop_resource_spec.rb b/spec/integration/recipes/noop_resource_spec.rb
index db6b668553..2f2c6e7ae4 100644
--- a/spec/integration/recipes/noop_resource_spec.rb
+++ b/spec/integration/recipes/noop_resource_spec.rb
@@ -13,11 +13,11 @@ describe "Resources with a no-op provider" do
end
it "does not blow up a run with a noop'd resource" do
- recipe = converge do
+ recipe = converge {
hi_there "blah" do
action :update
end
- end
+ }
expect(recipe.logged_warnings).to eq ""
end
end
diff --git a/spec/integration/recipes/provider_choice.rb b/spec/integration/recipes/provider_choice.rb
index dea58230db..3f9e87eb77 100644
--- a/spec/integration/recipes/provider_choice.rb
+++ b/spec/integration/recipes/provider_choice.rb
@@ -25,9 +25,9 @@ describe "Recipe DSL methods" do
end
it "provider_thingy 'blah' runs the provider and warns" do
- recipe = converge do
+ recipe = converge {
provider_thingy("blah") {}
- end
+ }
expect(recipe.logged_warnings).to match /hello from Chef::Provider::ProviderThingy/
expect(recipe.logged_warnings).to match /you must use 'provides' to provide DSL/i
end
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 766752ac13..75670722a4 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -8,8 +8,8 @@ describe "Recipe DSL methods" do
attr_accessor :current_index
end
- before(:all) { Namer.current_index = 1 }
- before { Namer.current_index += 1 }
+ before(:all) do Namer.current_index = 1 end
+ before do Namer.current_index += 1 end
context "with resource 'base_thingy' declared as BaseThingy" do
before(:each) do
@@ -50,18 +50,18 @@ describe "Recipe DSL methods" do
end
it "creates base_thingy when you call base_thingy in a recipe" do
- recipe = converge do
+ recipe = converge {
base_thingy("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_name).to eq "blah"
expect(BaseThingy.created_resource).to eq BaseThingy
end
it "errors when you call base_thingy do ... end in a recipe" do
- expect_converge do
+ expect_converge {
base_thingy { ; }
- end.to raise_error(Chef::Exceptions::ValidationFailed)
+ }.to raise_error(Chef::Exceptions::ValidationFailed)
end
context "nameless resources" do
@@ -75,9 +75,9 @@ describe "Recipe DSL methods" do
end
it "does not error when not given a name" do
- recipe = converge do
+ recipe = converge {
nameless_thingy {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_name).to eq ""
expect(BaseThingy.created_resource).to eq NamelessThingy
@@ -98,9 +98,9 @@ describe "Recipe DSL methods" do
end
it "bar_thingy does not work" do
- expect_converge do
+ expect_converge {
bar_thingy("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
end
@@ -114,9 +114,9 @@ describe "Recipe DSL methods" do
end
it "no_name_thingy does not work" do
- expect_converge do
+ expect_converge {
no_name_thingy("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
end
@@ -130,15 +130,15 @@ describe "Recipe DSL methods" do
end
it "another_no_name_thingy does not work" do
- expect_converge do
+ expect_converge {
another_no_name_thingy("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "another_thingy_name works" do
- recipe = converge do
+ recipe = converge {
another_thingy_name("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy)
end
@@ -155,21 +155,21 @@ describe "Recipe DSL methods" do
end
it "another_no_name_thingy does not work" do
- expect_converge do
+ expect_converge {
another_no_name_thingy2("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "another_thingy_name2 does not work" do
- expect_converge do
+ expect_converge {
another_thingy_name2("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "yet_another_thingy_name3 works" do
- recipe = converge do
+ recipe = converge {
another_thingy_name3("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy2)
end
@@ -187,19 +187,19 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_no_name_thingy3 does not work" do
- expect_converge do
+ expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_no_name_thingy3("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy3 works" do
- recipe = converge do
+ recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_no_name_thingy3("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy3)
end
@@ -217,29 +217,29 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_no_name_thingy4 does not work" do
- expect_converge do
+ expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_no_name_thingy4("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy4 works" do
- recipe = converge do
+ recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_no_name_thingy4("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
it "and platform_family = foo, another_no_name_thingy4 works" do
- recipe = converge do
+ recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:platform_family] = "foo"
another_no_name_thingy4("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
@@ -256,27 +256,27 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_no_name_thingy5 does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_no_name_thingy5("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy5 works" do
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_no_name_thingy5("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
it "the new resource name can be used in a recipe" do
- recipe = converge do
+ recipe = converge {
another_thingy_name_for_another_no_name_thingy5("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
@@ -293,27 +293,27 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_no_name_thingy6 does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_no_name_thingy6("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy6 works" do
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_no_name_thingy6("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
it "the new resource name can be used in a recipe" do
- recipe = converge do
+ recipe = converge {
another_thingy_name_for_another_no_name_thingy6("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
@@ -330,29 +330,29 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_thingy_name_for_another_no_name_thingy7 does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_thingy_name_for_another_no_name_thingy7("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy7 works" do
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_thingy_name_for_another_no_name_thingy7("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy7)
end
it "the old resource name does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_no_name_thingy_7("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
end
@@ -368,29 +368,29 @@ describe "Recipe DSL methods" do
end
it "and os = linux, another_thingy_name_for_another_no_name_thingy8 does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_thingy_name_for_another_no_name_thingy8("blah") {}
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy8 works" do
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
another_thingy_name_for_another_no_name_thingy8("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy8)
end
it "the old resource name does not work" do
- expect_converge do
+ expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
another_thingy_name8("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
end
end
@@ -407,15 +407,15 @@ describe "Recipe DSL methods" do
end
it "my_supplier does not work in a recipe" do
- expect_converge do
+ expect_converge {
my_supplier("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "hemlock works in a recipe" do
- expect_recipe do
+ expect_recipe {
hemlock("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::MySupplier
end
end
@@ -430,9 +430,9 @@ describe "Recipe DSL methods" do
end
it "thingy3 works in a recipe" do
- expect_recipe do
+ expect_recipe {
thingy3("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -446,16 +446,16 @@ describe "Recipe DSL methods" do
end
it "thingy3 works in a recipe and yields Thingy4 (the last one)" do
- recipe = converge do
+ recipe = converge {
thingy3("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy4
end
it "thingy4 does not work in a recipe" do
- expect_converge do
+ expect_converge {
thingy4("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "resource_matching_short_name returns Thingy4" do
@@ -477,9 +477,9 @@ describe "Recipe DSL methods" do
end
it "thingy5 works in a recipe" do
- expect_recipe do
+ expect_recipe {
thingy5("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -494,16 +494,16 @@ describe "Recipe DSL methods" do
end
it "thingy6 works in a recipe and yields Thingy6" do
- recipe = converge do
+ recipe = converge {
thingy6("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy6
end
it "thingy5 works in a recipe and yields Foo::Thingy6 (the last one)" do
- recipe = converge do
+ recipe = converge {
thingy5("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy6
end
@@ -521,9 +521,9 @@ describe "Recipe DSL methods" do
end
it "thingy5reverse works in a recipe and yields AThingy5 (the alphabetical one)" do
- recipe = converge do
+ recipe = converge {
thingy5reverse("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::AThingy5
end
end
@@ -540,9 +540,9 @@ describe "Recipe DSL methods" do
end
it "thingy5_2 works in a recipe and yields the ZRecipeDSLSpaceNamespace one (the last one)" do
- recipe = converge do
+ recipe = converge {
thingy5_2("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq ZRecipeDSLSpecNamespace::Thingy5
end
end
@@ -559,9 +559,9 @@ describe "Recipe DSL methods" do
end
it "thingy5_2reverse works in a recipe and yields the ARecipeDSLSpaceNamespace one (the alphabetical one)" do
- recipe = converge do
+ recipe = converge {
thingy5_2reverse("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq ARecipeDSLSpecNamespace::Thingy5
end
end
@@ -577,9 +577,9 @@ describe "Recipe DSL methods" do
end
it "thingy3 works in a recipe" do
- expect_recipe do
+ expect_recipe {
thingy3("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -593,16 +593,16 @@ describe "Recipe DSL methods" do
end
it "thingy3 works in a recipe and yields Thingy4 (the last one)" do
- recipe = converge do
+ recipe = converge {
thingy3("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy4
end
it "thingy4 does not work in a recipe" do
- expect_converge do
+ expect_converge {
thingy4("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "resource_matching_short_name returns Thingy4" do
@@ -620,16 +620,16 @@ describe "Recipe DSL methods" do
end
it "thingy3 works in a recipe and yields Thingy4 (the last one)" do
- recipe = converge do
+ recipe = converge {
thingy3("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy4
end
it "thingy4 does not work in a recipe" do
- expect_converge do
+ expect_converge {
thingy4("blah") {}
- end.to raise_error(NoMethodError)
+ }.to raise_error(NoMethodError)
end
it "resource_matching_short_name returns Thingy4" do
@@ -660,16 +660,16 @@ describe "Recipe DSL methods" do
end
it "thingy7 works in a recipe and yields Thingy7" do
- recipe = converge do
+ recipe = converge {
thingy7("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
end
it "thingy8 works in a recipe and yields Thingy7 (last)" do
- recipe = converge do
+ recipe = converge {
thingy8("blah") {}
- end
+ }
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy8
end
@@ -691,23 +691,23 @@ describe "Recipe DSL methods" do
end
it "thingy12 works in a recipe and yields Thingy12" do
- expect_recipe do
+ expect_recipe {
thingy12("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle works in a recipe and yields Thingy12" do
- expect_recipe do
+ expect_recipe {
twizzle("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle2 works in a recipe and yields Thingy12" do
- expect_recipe do
+ expect_recipe {
twizzle2("blah") {}
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
end
@@ -750,11 +750,11 @@ describe "Recipe DSL methods" do
it "A run with platform 'x' reports that my_super_thingy is not supported" do
r = Cheffish::ChefRun.new(chef_config)
r.client.run_context.node.automatic["platform"] = "x"
- expect do
+ expect {
r.compile_recipe do
my_super_thingy("blah") {}
end
- end.to raise_error(Chef::Exceptions::NoSuchResourceType)
+ }.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
end
@@ -804,7 +804,7 @@ describe "Recipe DSL methods" do
result.resource_name two_classes_one_dsl
result
end
- before { resource_class } # pull on it so it gets defined before the recipe runs
+ before do resource_class end # pull on it so it gets defined before the recipe runs
context "and another resource named 'A' with resource_name :two_classes_one_dsl" do
let(:resource_class_a) do
@@ -820,13 +820,13 @@ describe "Recipe DSL methods" do
result.resource_name two_classes_one_dsl
result
end
- before { resource_class_a } # pull on it so it gets defined before the recipe runs
+ before do resource_class_a end # pull on it so it gets defined before the recipe runs
it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_a
end
@@ -850,13 +850,13 @@ describe "Recipe DSL methods" do
result.resource_name two_classes_one_dsl
result
end
- before { resource_class_z } # pull on it so it gets defined before the recipe runs
+ before do resource_class_z end # pull on it so it gets defined before the recipe runs
it "two_classes_one_dsl resolves to Z (last)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -872,9 +872,9 @@ describe "Recipe DSL methods" do
it "two_classes_one_dsl resolves to Z (respects the priority array)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -890,9 +890,9 @@ describe "Recipe DSL methods" do
it "two_classes_one_dsl resolves to B (picks the next thing in the priority array)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -911,9 +911,9 @@ describe "Recipe DSL methods" do
it "two_classes_one_dsl resolves to Z (respects the most recent priority array)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -929,9 +929,9 @@ describe "Recipe DSL methods" do
it "two_classes_one_dsl resolves to B (picks the first match from the other priority array)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -954,9 +954,9 @@ describe "Recipe DSL methods" do
it "two_classes_one_dsl resolves to B (picks the first match outside the priority array)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -987,7 +987,7 @@ describe "Recipe DSL methods" do
result.provides two_classes_one_dsl
result
end
- before { provider_class } # pull on it so it gets defined before the recipe runs
+ before do provider_class end # pull on it so it gets defined before the recipe runs
context "and another provider named 'A'" do
let(:provider_class_a) do
@@ -1003,25 +1003,25 @@ describe "Recipe DSL methods" do
result
end
context "which provides :two_classes_one_dsl" do
- before { provider_class_a.provides two_classes_one_dsl }
+ before do provider_class_a.provides two_classes_one_dsl end
it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_a
end
end
context "which provides(:two_classes_one_dsl) { false }" do
- before { provider_class_a.provides(two_classes_one_dsl) { false } }
+ before do provider_class_a.provides(two_classes_one_dsl) { false } end
it "two_classes_one_dsl resolves to B (since A declined)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1041,28 +1041,28 @@ describe "Recipe DSL methods" do
end
result
end
- before { provider_class_z } # pull on it so it gets defined before the recipe runs
+ before do provider_class_z end # pull on it so it gets defined before the recipe runs
context "which provides :two_classes_one_dsl" do
- before { provider_class_z.provides two_classes_one_dsl }
+ before do provider_class_z.provides two_classes_one_dsl end
it "two_classes_one_dsl resolves to Z (last)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_z
end
context "with a priority array [ Z, B ]" do
- before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] }
+ before do Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] end
it "two_classes_one_dsl resolves to Z (respects the priority map)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_z
end
@@ -1070,30 +1070,30 @@ describe "Recipe DSL methods" do
end
context "which provides(:two_classes_one_dsl) { false }" do
- before { provider_class_z.provides(two_classes_one_dsl) { false } }
+ before do provider_class_z.provides(two_classes_one_dsl) { false } end
context "with a priority array [ Z, B ]" do
- before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] }
+ before do Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] end
it "two_classes_one_dsl resolves to B (the next one in the priority map)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
context "with priority arrays [ B ] and [ Z ]" do
- before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z ] }
- before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class ] }
+ before do Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z ] end
+ before do Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class ] end
it "two_classes_one_dsl resolves to B (the one in the next priority map)" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1117,26 +1117,26 @@ describe "Recipe DSL methods" do
result.provides two_classes_one_dsl, os: "blarghle"
result
end
- before { resource_class_blarghle } # pull on it so it gets defined before the recipe runs
+ before do resource_class_blarghle end # pull on it so it gets defined before the recipe runs
it "on os = blarghle, two_classes_one_dsl resolves to Blarghle" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "blarghle"
instance_eval("#{temp_two_classes_one_dsl} 'blah' do; end")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_blarghle
end
it "on os = linux, two_classes_one_dsl resolves to B" do
temp_two_classes_one_dsl = two_classes_one_dsl
- recipe = converge do
+ recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
run_context.node.automatic[:os] = "linux"
instance_eval("#{temp_two_classes_one_dsl} 'blah' do; end")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -1174,9 +1174,9 @@ describe "Recipe DSL methods" do
it "my_resource returns the resource and calls provides?, but does not emit a warning" do
dsl_name = my_resource
- recipe = converge do
+ recipe = converge {
instance_eval("#{dsl_name} 'foo'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
expect(resource_class.called_provides).to be_truthy
@@ -1216,9 +1216,9 @@ describe "Recipe DSL methods" do
it "my_resource runs the provider and does not emit a warning" do
temp_my_resource = my_resource
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_my_resource} 'foo'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1246,9 +1246,9 @@ describe "Recipe DSL methods" do
it "my_resource runs the first provider" do
temp_my_resource = my_resource
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_my_resource} 'foo'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1263,9 +1263,9 @@ describe "Recipe DSL methods" do
# TODO no warning? ick
it "my_resource runs the provider anyway" do
temp_my_resource = my_resource
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_my_resource} 'foo'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1291,13 +1291,13 @@ describe "Recipe DSL methods" do
end
end
end
- before { provider_class2 } # make sure the provider class shows up
+ before do provider_class2 end # make sure the provider class shows up
it "my_resource runs the other provider" do
temp_my_resource = my_resource
- recipe = converge do
+ recipe = converge {
instance_eval("#{temp_my_resource} 'foo'")
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class2
end
@@ -1317,17 +1317,17 @@ describe "Recipe DSL methods" do
end
it "utf-8 dsl names work" do
- recipe = converge do
+ recipe = converge {
Straße("blah") {}
- end
+ }
expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(UTF8Thingy)
end
end
end
- before(:all) { Namer.current_index = 0 }
- before { Namer.current_index += 1 }
+ before(:all) do Namer.current_index = 0 end
+ before do Namer.current_index += 1 end
context "with an LWRP that declares actions" do
let(:resource_class) do
diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb
index c8da9196ca..f2f9936f9b 100644
--- a/spec/integration/recipes/resource_action_spec.rb
+++ b/spec/integration/recipes/resource_action_spec.rb
@@ -103,14 +103,14 @@ module ResourceActionSpec
end
it "the action cannot access private methods" do
- expect do
+ expect {
converge(<<-EOM, __FILE__, __LINE__ + 1)
#{resource_dsl} "hi" do
foo "foo!"
action :access_private_method
end
EOM
- end.to raise_error(NameError)
+ }.to raise_error(NameError)
expect(ActionJackson.ran_action).to eq :access_private_method
end
@@ -249,7 +249,7 @@ module ResourceActionSpec
end
it "Can retrieve ancestors of action class without crashing" do
- converge { action_jackson "hi" }
+ converge do action_jackson "hi" end
expect { ActionJackson.action_class.ancestors.join(",") }.not_to raise_error
end
@@ -371,9 +371,9 @@ module ResourceActionSpec
context "With a resource with a UTF-8 action" do
it "Running the action works" do
- expect_recipe do
+ expect_recipe {
weird_action_jackson "hi"
- end.to be_up_to_date
+ }.to be_up_to_date
expect(WeirdActionJackson.action_was).to eq :Straße
end
end
@@ -398,11 +398,11 @@ module ResourceActionSpec
end
it "Setting group to nil in an action does not emit a warning about it being defined in two places" do
- expect_recipe do
+ expect_recipe {
resource_action_spec_set_group_to_nil "hi" do
action :set_group_to_nil
end
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
end
end
@@ -444,9 +444,9 @@ module ResourceActionSpec
it "the methods are available to the action" do
r = nil
- expect_recipe do
+ expect_recipe {
r = declares_action_class_methods "hi"
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(r.x).to eq(4)
end
@@ -467,9 +467,9 @@ module ResourceActionSpec
it "the methods are available to the action" do
r = nil
- expect_recipe do
+ expect_recipe {
r = declares_action_class_methods_too "hi"
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(r.x).to eq(8)
end
end
@@ -492,9 +492,9 @@ module ResourceActionSpec
it "the methods are available to the action" do
r = nil
- expect_recipe do
+ expect_recipe {
r = declares_action_class_methods_too "hi"
- end.to emit_no_warnings_or_errors
+ }.to emit_no_warnings_or_errors
expect(r.x).to eq(8)
end
end
diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb
index 605cb2c941..2cb3b5fc3a 100644
--- a/spec/integration/recipes/resource_converge_if_changed_spec.rb
+++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb
@@ -13,9 +13,9 @@ describe "Resource::ActionClass#converge_if_changed" do
attr_writer :incrementing_value
end
- before(:all) { Namer.current_index = 1 }
- before { Namer.current_index += 1 }
- before { Namer.incrementing_value = 0 }
+ before(:all) do Namer.current_index = 1 end
+ before do Namer.current_index += 1 end
+ before do Namer.incrementing_value = 0 end
context "when the resource has identity, state, control, and sensitive properties" do
let(:resource_name) { :"converge_if_changed_dsl#{Namer.current_index}" }
diff --git a/spec/integration/recipes/resource_load_spec.rb b/spec/integration/recipes/resource_load_spec.rb
index 79df1d6478..860f4b0080 100644
--- a/spec/integration/recipes/resource_load_spec.rb
+++ b/spec/integration/recipes/resource_load_spec.rb
@@ -13,9 +13,9 @@ describe "Resource.load_current_value" do
attr_writer :incrementing_value
end
- before(:all) { Namer.current_index = 1 }
- before { Namer.current_index += 1 }
- before { Namer.incrementing_value = 0 }
+ before(:all) do Namer.current_index = 1 end
+ before do Namer.current_index += 1 end
+ before do Namer.incrementing_value = 0 end
let(:resource_name) { :"load_current_value_dsl#{Namer.current_index}" }
let(:resource_class) do
@@ -40,7 +40,7 @@ describe "Resource.load_current_value" do
end
# Pull on resource_class to initialize it
- before { resource_class }
+ before do resource_class end
context "with a resource with load_current_value" do
before :each do
@@ -57,9 +57,9 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge do
- r = public_send(e.resource_name, "blah") do
+ r = public_send(e.resource_name, "blah") {
x "desired"
- end
+ }
end
r
end
@@ -131,15 +131,15 @@ describe "Resource.load_current_value" do
end
# Pull on subresource_class to initialize it
- before { subresource_class }
+ before do subresource_class end
let(:subresource) do
e = self
r = nil
converge do
- r = public_send(e.subresource_name, "blah") do
+ r = public_send(e.subresource_name, "blah") {
x "desired"
- end
+ }
end
r
end
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 451943e225..f19cc682c4 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -180,7 +180,7 @@ describe Chef::Dist::SOLOEXEC do
EOM
# We have a timeout protection here so that if due to some bug
# run_lock gets stuck we can discover it.
- expect do
+ expect {
Timeout.timeout(120) do
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..")
@@ -200,7 +200,7 @@ describe Chef::Dist::SOLOEXEC do
threads.each(&:join)
end
- end.not_to raise_error
+ }.not_to raise_error
# Unfortunately file / directory helpers in integration tests
# are implemented using before(:each) so we need to do all below