summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb5
-rw-r--r--lib/chef/api_client/registration.rb3
-rw-r--r--lib/chef/data_bag.rb3
-rw-r--r--lib/chef/file_access_control/windows.rb3
-rw-r--r--lib/chef/mixin/windows_env_helper.rb4
-rw-r--r--lib/chef/node.rb3
-rw-r--r--lib/chef/provider/execute.rb2
-rw-r--r--lib/chef/provider/reboot.rb2
-rw-r--r--lib/chef/provider/service/simple.rb3
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb3
-rw-r--r--lib/chef/win32/file.rb3
-rw-r--r--lib/chef/win32/net.rb12
-rw-r--r--lib/chef/win32/security/token.rb3
-rw-r--r--spec/functional/event_loggers/windows_eventlog_spec.rb10
-rw-r--r--spec/functional/resource/dsc_resource_spec.rb3
-rw-r--r--spec/functional/resource/group_spec.rb14
-rw-r--r--spec/functional/resource/powershell_script_spec.rb3
-rw-r--r--spec/functional/win32/security_spec.rb15
-rw-r--r--spec/integration/knife/config_list_profiles_spec.rb3
-rw-r--r--spec/integration/knife/cookbook_download_spec.rb2
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb3
-rw-r--r--spec/support/shared/functional/http.rb38
-rw-r--r--spec/support/shared/functional/windows_script.rb3
-rw-r--r--spec/support/shared/integration/app_server_support.rb7
-rw-r--r--spec/support/shared/unit/application_dot_d.rb12
-rw-r--r--spec/unit/application/exit_code_spec.rb3
-rw-r--r--spec/unit/dsl/data_query_spec.rb3
-rw-r--r--spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb3
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb3
-rw-r--r--spec/unit/http/authenticator_spec.rb3
-rw-r--r--spec/unit/knife/bootstrap_spec.rb14
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb6
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb4
-rw-r--r--spec/unit/knife/core/windows_bootstrap_context_spec.rb3
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb3
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb3
-rw-r--r--spec/unit/knife/status_spec.rb3
-rw-r--r--spec/unit/knife/supermarket_install_spec.rb3
-rw-r--r--spec/unit/knife_spec.rb3
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb9
-rw-r--r--spec/unit/provider/group/dscl_spec.rb2
-rw-r--r--spec/unit/provider/group_spec.rb3
-rw-r--r--spec/unit/provider/launchd_spec.rb24
-rw-r--r--spec/unit/provider/link_spec.rb33
-rw-r--r--spec/unit/provider/osx_profile_spec.rb8
-rw-r--r--spec/unit/provider/package/apt_spec.rb8
-rw-r--r--spec/unit/provider/package/openbsd_spec.rb12
-rw-r--r--spec/unit/provider/package/windows_spec.rb3
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb3
-rw-r--r--spec/unit/provider/service/freebsd_service_spec.rb12
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb12
-rw-r--r--spec/unit/provider/service/windows_spec.rb74
-rw-r--r--spec/unit/provider/subversion_spec.rb12
-rw-r--r--spec/unit/resource/osx_profile_spec.rb3
-rw-r--r--spec/unit/resource/powershell_script_spec.rb15
-rw-r--r--spec/unit/run_list/run_list_expansion_spec.rb13
-rw-r--r--spec/unit/search/query_spec.rb3
-rw-r--r--spec/unit/shell/shell_session_spec.rb9
-rw-r--r--spec/unit/util/powershell/ps_credential_spec.rb5
-rw-r--r--spec/unit/win32/security_spec.rb3
60 files changed, 296 insertions, 189 deletions
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index e1717b6574..e1cab3d4d0 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -375,7 +375,8 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
before do
ChefConfig::Config[:config_d_dir] = tempdir
allow(config_loader).to receive(:path_exists?).with(
- an_instance_of(String)).and_return(false)
+ an_instance_of(String)
+ ).and_return(false)
end
after do
@@ -516,7 +517,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
-----BEGIN RSA PRIVATE KEY-----
foo
EOH
-)
+ )
end
end
diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb
index 270945cfc2..fea4b001bc 100644
--- a/lib/chef/api_client/registration.rb
+++ b/lib/chef/api_client/registration.rb
@@ -162,8 +162,7 @@ class Chef
api_version: "0",
client_name: Chef::Config[:validation_client_name],
signing_key_filename: Chef::Config[:validation_key],
- }
- )
+ })
end
# Whether or not to generate keys locally and post the public key to the
diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb
index d7e2de7397..67180559da 100644
--- a/lib/chef/data_bag.rb
+++ b/lib/chef/data_bag.rb
@@ -98,7 +98,8 @@ class Chef
end
names += Dir.glob(File.join(
- Chef::Util::PathHelper.escape_glob_dir(path), "*")).map { |f| File.basename(f) }.sort
+ Chef::Util::PathHelper.escape_glob_dir(path), "*"
+ )).map { |f| File.basename(f) }.sort
end
names.inject({}) { |h, n| h[n] = n; h }
else
diff --git a/lib/chef/file_access_control/windows.rb b/lib/chef/file_access_control/windows.rb
index e14c5a2746..de08a31876 100644
--- a/lib/chef/file_access_control/windows.rb
+++ b/lib/chef/file_access_control/windows.rb
@@ -34,7 +34,8 @@ class Chef
# We want to mix these in as class methods
def writable?(path)
::File.exists?(path) && Chef::ReservedNames::Win32::File.file_access_check(
- path, Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE)
+ path, Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE
+ )
end
end
diff --git a/lib/chef/mixin/windows_env_helper.rb b/lib/chef/mixin/windows_env_helper.rb
index 6a5240c005..8036fa2bbe 100644
--- a/lib/chef/mixin/windows_env_helper.rb
+++ b/lib/chef/mixin/windows_env_helper.rb
@@ -46,8 +46,8 @@ class Chef
if SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string("Environment").address, flags, 5000, nil) == 0
Chef::ReservedNames::Win32::Error.raise!
end
- if SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string(
- utf8_to_wide("Environment")
+ if SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string(
+ utf8_to_wide("Environment")
).address, flags, 5000, nil) == 0
Chef::ReservedNames::Win32::Error.raise!
end
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index 6d5bb6d8e4..dfd2c685e1 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -121,7 +121,8 @@ class Chef
{ name: { kind_of: String,
cannot_be: :blank,
regex: /^[\-[:alnum:]_:.]+$/ },
- })
+ }
+ )
@name = arg
else
@name
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index c4312b58b4..61107a84ba 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -121,7 +121,7 @@ class Chef
def sentinel_file
Pathname.new(Chef::Util::PathHelper.cleanpath(
- ( cwd && creates_relative? ) ? ::File.join(cwd, creates) : creates
+ ( cwd && creates_relative? ) ? ::File.join(cwd, creates) : creates
))
end
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index 407d847313..7fd3c32d53 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -49,7 +49,7 @@ class Chef
reason: new_resource.reason,
timestamp: Time.now,
requested_by: new_resource.name
- )
+ )
end
def action_request_reboot
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index 302a2e75f4..754437b4a0 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -73,7 +73,8 @@ class Chef
requirements.assert(:all_actions) do |a|
a.assertion do
@new_resource.status_command || supports[:status] ||
- (!ps_cmd.nil? && !ps_cmd.empty?) end
+ (!ps_cmd.nil? && !ps_cmd.empty?)
+ end
a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this node's 'command.ps' attribute"
end
requirements.assert(:all_actions) do |a|
diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb
index 0c101b204d..6f3dd908b8 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -40,7 +40,8 @@ class Chef::Util::DSC
document_generation_cmdlet = Chef::Util::Powershell::Cmdlet.new(
@node,
- configuration_document_generation_code(script_path, configuration_name))
+ configuration_document_generation_code(script_path, configuration_name)
+ )
merged_configuration_flags = get_merged_configuration_flags!(configuration_flags, configuration_name)
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index 58e28735cb..4fac3fe797 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -182,7 +182,8 @@ class Chef
Chef::ReservedNames::Win32::Security::STANDARD_RIGHTS_READ
token = Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
- token_rights)
+ token_rights
+ )
duplicate_token = token.duplicate_token(:SecurityImpersonation)
mapping = Chef::ReservedNames::Win32::Security::GENERIC_MAPPING.new
diff --git a/lib/chef/win32/net.rb b/lib/chef/win32/net.rb
index b92b723e27..1c08f2fbeb 100644
--- a/lib/chef/win32/net.rb
+++ b/lib/chef/win32/net.rb
@@ -224,7 +224,8 @@ class Chef
buf = FFI::MemoryPointer.new(LOCALGROUP_MEMBERS_INFO_3, members.size)
Array.new(members.size) do |i|
member_info = LOCALGROUP_MEMBERS_INFO_3.new(
- buf + i * LOCALGROUP_MEMBERS_INFO_3.size)
+ buf + i * LOCALGROUP_MEMBERS_INFO_3.size
+ )
member_info[:lgrmi3_domainandname] = FFI::MemoryPointer.from_string(wstring(members[i]))
member_info
end
@@ -236,7 +237,8 @@ class Chef
lgrmi3s = members_to_lgrmi3(members)
rc = NetLocalGroupAddMembers(
- server_name, group_name, 3, lgrmi3s[0], members.size)
+ server_name, group_name, 3, lgrmi3s[0], members.size
+ )
if rc != NERR_Success
Chef::ReservedNames::Win32::Error.raise!(nil, rc)
@@ -249,7 +251,8 @@ class Chef
lgrmi3s = members_to_lgrmi3(members)
rc = NetLocalGroupSetMembers(
- server_name, group_name, 3, lgrmi3s[0], members.size)
+ server_name, group_name, 3, lgrmi3s[0], members.size
+ )
if rc != NERR_Success
Chef::ReservedNames::Win32::Error.raise!(nil, rc)
@@ -262,7 +265,8 @@ class Chef
lgrmi3s = members_to_lgrmi3(members)
rc = NetLocalGroupDelMembers(
- server_name, group_name, 3, lgrmi3s[0], members.size)
+ server_name, group_name, 3, lgrmi3s[0], members.size
+ )
if rc != NERR_Success
Chef::ReservedNames::Win32::Error.raise!(nil, rc)
diff --git a/lib/chef/win32/security/token.rb b/lib/chef/win32/security/token.rb
index 5710d896b7..78c79fbb44 100644
--- a/lib/chef/win32/security/token.rb
+++ b/lib/chef/win32/security/token.rb
@@ -35,7 +35,8 @@ class Chef
def enable_privileges(*privilege_names)
# Build the list of privileges we want to set
new_privileges = Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES.new(
- FFI::MemoryPointer.new(Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES.size_with_privileges(privilege_names.length)))
+ FFI::MemoryPointer.new(Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES.size_with_privileges(privilege_names.length))
+ )
new_privileges[:PrivilegeCount] = 0
privilege_names.each do |privilege_name|
luid = Chef::ReservedNames::Win32::API::Security::LUID.new
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb
index c1e5150428..ca15d3e38d 100644
--- a/spec/functional/event_loggers/windows_eventlog_spec.rb
+++ b/spec/functional/event_loggers/windows_eventlog_spec.rb
@@ -49,16 +49,18 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only do
logger.run_start(version, run_status)
expect(event_log.read(flags, offset).any? do |e|
- e.source == Chef::Dist::PRODUCT && e.event_id == 10000 &&
- e.string_inserts[0].include?(version) end).to be_truthy
+ e.source == Chef::Dist::PRODUCT && e.event_id == 10000 &&
+ e.string_inserts[0].include?(version)
+ end ).to be_truthy
end
it "writes run_started event with event_id 10001 and contains the run_id" do
logger.run_started(run_status)
expect(event_log.read(flags, offset).any? do |e|
- e.source == Chef::Dist::PRODUCT && e.event_id == 10001 &&
- e.string_inserts[0].include?(run_id) end).to be_truthy
+ e.source == Chef::Dist::PRODUCT && e.event_id == 10001 &&
+ e.string_inserts[0].include?(run_id)
+ end ).to be_truthy
end
it "writes run_completed event with event_id 10002 and contains the run_id and elapsed time" do
diff --git a/spec/functional/resource/dsc_resource_spec.rb b/spec/functional/resource/dsc_resource_spec.rb
index 3491bb6bbe..8f5ba5fd9e 100644
--- a/spec/functional/resource/dsc_resource_spec.rb
+++ b/spec/functional/resource/dsc_resource_spec.rb
@@ -46,7 +46,8 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
it "raises an exception if the resource is not found" do
new_resource.resource "thisdoesnotexist"
expect { new_resource.run_action(:run) }.to raise_error(
- Chef::Exceptions::ResourceNotFound)
+ Chef::Exceptions::ResourceNotFound
+ )
end
end
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index f5bb458666..c17217b1f3 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -334,9 +334,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
describe "when group name is length 256", :windows_only do
let!(:group_name) do
"theoldmanwalkingdownthestreetalwayshadagood\
-smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
-theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
-downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" end
+ smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
+ theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
+ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree"
+ end
it "should create a group" do
group_resource.run_action(:create)
@@ -360,9 +361,10 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" end
context "group create action: when group name length is more than 256", :windows_only do
let!(:group_name) do
"theoldmanwalkingdownthestreetalwayshadagood\
-smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
-theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
-downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
+ smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
+ theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
+ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ"
+ end
it "should not create a group" do
expect { group_resource.run_action(:create) }.to raise_error(ArgumentError)
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index 4473b242c4..74ece0d33c 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -590,7 +590,8 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
resource.only_if "$true", architecture: :i386
expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
- /cannot execute script with requested architecture 'i386' on Windows Nano Server/)
+ /cannot execute script with requested architecture 'i386' on Windows Nano Server/
+ )
end
end
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index c72da9ce6c..a72088a079 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -61,7 +61,8 @@ describe "Chef::Win32::Security", :windows_only do
describe "get_file_security" do
it "should return a security descriptor when called with a path that exists" do
security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(
- "C:\\Program Files")
+ "C:\\Program Files"
+ )
# Make sure the security descriptor works
expect(security_descriptor.dacl_present?).to be true
end
@@ -70,7 +71,8 @@ describe "Chef::Win32::Security", :windows_only do
describe "access_check" do
let(:security_descriptor) do
Chef::ReservedNames::Win32::Security.get_file_security(
- "C:\\Program Files")
+ "C:\\Program Files"
+ )
end
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
@@ -78,7 +80,8 @@ describe "Chef::Win32::Security", :windows_only do
let(:token) do
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
- token_rights).duplicate_token(:SecurityImpersonation)
+ token_rights
+ ).duplicate_token(:SecurityImpersonation)
end
let(:mapping) do
@@ -102,7 +105,8 @@ describe "Chef::Win32::Security", :windows_only do
let(:token) do
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
- token_rights)
+ token_rights
+ )
end
context "with all rights" do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
@@ -127,7 +131,8 @@ describe "Chef::Win32::Security", :windows_only do
let(:token) do
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
- token_rights)
+ token_rights
+ )
end
context "when the token is valid" do
diff --git a/spec/integration/knife/config_list_profiles_spec.rb b/spec/integration/knife/config_list_profiles_spec.rb
index 32846f9999..044b50b5be 100644
--- a/spec/integration/knife/config_list_profiles_spec.rb
+++ b/spec/integration/knife/config_list_profiles_spec.rb
@@ -183,6 +183,7 @@ describe "knife config list-profiles", :workstation do
{ "profile" => "default", "active" => true, "client_name" => "testuser", "client_key" => path_to(".chef/testkey.pem"), "server_url" => "https://example.com/organizations/testorg" },
{ "profile" => "prod", "active" => false, "client_name" => "testuser", "client_key" => path_to(".chef/testkey.pem"), "server_url" => "https://example.com/organizations/prod" },
{ "profile" => "qa", "active" => false, "client_name" => "qauser", "client_key" => path_to("src/qauser.pem"), "server_url" => "https://example.com/organizations/testorg" },
- ] }
+ ]
+ }
end
end
diff --git a/spec/integration/knife/cookbook_download_spec.rb b/spec/integration/knife/cookbook_download_spec.rb
index 3fe801b64c..538c06802b 100644
--- a/spec/integration/knife/cookbook_download_spec.rb
+++ b/spec/integration/knife/cookbook_download_spec.rb
@@ -65,7 +65,7 @@ describe "knife cookbook download", :workstation do
Downloading root_files
Cookbook downloaded to #{tmpdir}/x-1.0.1
EOM
-)
+ )
end
end
end
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 29ac41fdce..766752ac13 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -1153,7 +1153,8 @@ describe "Recipe DSL methods" do
def to_s
"MyResource"
end
- end end
+ end
+ end
let(:my_resource) { :"my_resource#{Namer.current_index}" }
let(:blarghle_blarghle_little_star) { :"blarghle_blarghle_little_star#{Namer.current_index}" }
diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb
index 58189e543f..f006c6a24a 100644
--- a/spec/support/shared/functional/http.rb
+++ b/spec/support/shared/functional/http.rb
@@ -74,10 +74,9 @@ module ChefHTTPShared
@api.get("/nyan_cat_content_length.png", 200, nil,
{
"Content-Length" => nyan_uncompressed_size.to_s,
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
# (expected_content should be uncompressed)
@api.get("/nyan_cat_content_length_compressed.png", 200, nil,
@@ -85,10 +84,9 @@ module ChefHTTPShared
"Content-Length" => nyan_compressed_size.to_s,
"Content-Type" => "application/gzip",
"Content-Encoding" => "gzip",
- }
- ) do
- File.open(nyan_compressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_compressed_filename, "rb", &:read)
+ end
#
# endpoints that simulate truncated downloads (bad content-length header)
@@ -98,10 +96,9 @@ module ChefHTTPShared
@api.get("/nyan_cat_truncated.png", 200, nil,
{
"Content-Length" => (nyan_uncompressed_size + 1).to_s,
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
# (expected_content should be uncompressed)
@api.get("/nyan_cat_truncated_compressed.png", 200, nil,
@@ -109,10 +106,9 @@ module ChefHTTPShared
"Content-Length" => (nyan_compressed_size + 1).to_s,
"Content-Type" => "application/gzip",
"Content-Encoding" => "gzip",
- }
- ) do
- File.open(nyan_compressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_compressed_filename, "rb", &:read)
+ end
#
# in the presence of a transfer-encoding header, we must ignore the content-length (this bad content-length should work)
@@ -123,10 +119,9 @@ module ChefHTTPShared
{
"Content-Length" => (nyan_uncompressed_size + 1).to_s,
"Transfer-Encoding" => "anything",
- }
- ) do
- File.open(nyan_uncompressed_filename, "rb", &:read)
- end
+ }) do
+ File.open(nyan_uncompressed_filename, "rb", &:read)
+ end
#
# 403 with a Content-Length
@@ -134,8 +129,7 @@ module ChefHTTPShared
@api.get("/forbidden", 403, "Forbidden",
{
"Content-Length" => "Forbidden".bytesize.to_s,
- }
- )
+ })
@api.post("/posty", 200, "Hi!")
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index 5eb68952d7..49fd727055 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -114,7 +114,8 @@ shared_context Chef::Resource::WindowsScript do
resource.only_if resource_guard_command, architecture: guard_architecture
expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
- /cannot execute script with requested architecture 'i386' on Windows Nano Server/)
+ /cannot execute script with requested architecture 'i386' on Windows Nano Server/
+ )
end
end
end
diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb
index 7f05b14689..317a5a2679 100644
--- a/spec/support/shared/integration/app_server_support.rb
+++ b/spec/support/shared/integration/app_server_support.rb
@@ -27,10 +27,9 @@ module AppServerSupport
Rack::Handler::WEBrick.run(app,
Port: 9018,
AccessLog: [],
- Logger: WEBrick::Log.new(StringIO.new, 7)
- ) do |found_server|
- server = found_server
- end
+ Logger: WEBrick::Log.new(StringIO.new, 7)) do |found_server|
+ server = found_server
+ end
end
Timeout.timeout(30) do
sleep(0.01) until server && server.status == :Running
diff --git a/spec/support/shared/unit/application_dot_d.rb b/spec/support/shared/unit/application_dot_d.rb
index 505fe08190..0f2f06eff8 100644
--- a/spec/support/shared/unit/application_dot_d.rb
+++ b/spec/support/shared/unit/application_dot_d.rb
@@ -33,7 +33,9 @@ shared_examples_for "an application that loads a dot d" do
# make sure that we are correctly globbing.
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../../data/client.d_00")) end
+ File.join(File.dirname(__FILE__), "../../../data/client.d_00")
+ )
+ end
it "loads the configuration in order" do
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/00-foo.rb").cleanpath.to_s).and_return("foo 0")
@@ -50,7 +52,9 @@ shared_examples_for "an application that loads a dot d" do
context "when client_d_dir is set to a directory without configuration" do
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_01")
+ )
+ end
# client.d_01 has a nested folder with a rb file that if
# executed, would raise an exception. If it is executed,
@@ -66,7 +70,9 @@ shared_examples_for "an application that loads a dot d" do
# foo.rb as a directory should be ignored
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_02")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_02")
+ )
+ end
it "does not raise an exception" do
expect { app.reconfigure }.not_to raise_error
diff --git a/spec/unit/application/exit_code_spec.rb b/spec/unit/application/exit_code_spec.rb
index 270f05e598..7a02672796 100644
--- a/spec/unit/application/exit_code_spec.rb
+++ b/spec/unit/application/exit_code_spec.rb
@@ -70,7 +70,8 @@ describe Chef::Application::ExitCode do
it "does write a warning on non-standard exit codes" do
expect(Chef::Log).to receive(:warn).with(
- /attempted to exit with a non-standard exit code of 151/)
+ /attempted to exit with a non-standard exit code of 151/
+ )
expect(exit_codes.normalize_exit_code(151)).to eq(1)
end
diff --git a/spec/unit/dsl/data_query_spec.rb b/spec/unit/dsl/data_query_spec.rb
index 00a1f47fcf..afc2eacbd7 100644
--- a/spec/unit/dsl/data_query_spec.rb
+++ b/spec/unit/dsl/data_query_spec.rb
@@ -68,7 +68,8 @@ describe Chef::DSL::DataQuery do
"a1" => [1, 2, 3],
"a2" => { "b1" => true },
},
- } end
+ }
+ end
let(:item) do
item = Chef::DataBagItem.new
diff --git a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
index 7e885f8818..f8fcb654d9 100644
--- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
+++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
@@ -47,7 +47,8 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
"a1" => [1, 2, 3],
"a2" => { "b1" => true },
},
- } end
+ }
+ end
let(:version) { 1 }
let(:encoded_data) do
diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb
index 14b5d9eb28..f406aa2ad0 100644
--- a/spec/unit/encrypted_data_bag_item_spec.rb
+++ b/spec/unit/encrypted_data_bag_item_spec.rb
@@ -325,7 +325,8 @@ describe Chef::EncryptedDataBagItem do
"id" => "item_name",
"greeting" => "hello",
"nested" => { "a1" => [1, 2, 3], "a2" => { "b1" => true } },
- } end
+ }
+ end
let(:secret) { "abc123SECRET" }
let(:encoded_data) { subject.encrypt_data_bag_item(plaintext_data, secret) }
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb
index 89fff82f04..0713aacc24 100644
--- a/spec/unit/http/authenticator_spec.rb
+++ b/spec/unit/http/authenticator_spec.rb
@@ -92,7 +92,8 @@ describe Chef::HTTP::Authenticator do
it "calls authentication_headers with the proper input" do
expect(class_instance).to receive(:authentication_headers).with(
method, url, data,
- { "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }).and_return({})
+ { "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION }
+ ).and_return({})
class_instance.handle_request(method, url, headers, data)
end
end
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index ebc4e13ee5..5f4be8dfa2 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -35,7 +35,8 @@ describe Chef::Knife::Bootstrap do
double("TrainConnector",
windows?: windows_test,
linux?: linux_test,
- unix?: unix_test) end
+ unix?: unix_test)
+ end
let(:knife) do
Chef::Log.logger = Logger.new(StringIO.new)
@@ -569,7 +570,9 @@ describe Chef::Knife::Bootstrap do
context "when client_d_dir is set" do
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_00")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_00")
+ )
+ end
it "creates /etc/chef/client.d" do
expect(rendered_template).to match("mkdir -p /etc/chef/client\.d")
@@ -594,7 +597,9 @@ describe Chef::Knife::Bootstrap do
context "a nested directory structure" do
let(:client_d_dir) do
Chef::Util::PathHelper.cleanpath(
- File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
+ File.join(File.dirname(__FILE__), "../../data/client.d_01")
+ )
+ end
it "creates a file foo/bar.rb" do
expect(rendered_template).to match("cat > /etc/chef/client.d/foo/bar.rb <<'EOP'")
expect(rendered_template).to match("1 / 0")
@@ -1554,7 +1559,8 @@ describe Chef::Knife::Bootstrap do
ssl: false,
ssl_peer_fingerprint: nil,
operation_timeout: 60,
- } end
+ }
+ end
it "generates a correct configuration hash with expected defaults" do
expect(knife.winrm_opts).to eq expected
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index 8bff31197c..9c371c4140 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -264,7 +264,8 @@ describe Chef::Knife::CookbookUpload do
it "should warn users that no cookbooks exist" do
knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
expect(knife.ui).to receive(:warn).with(
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./)
+ /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./
+ )
knife.run
end
end
@@ -273,7 +274,8 @@ describe Chef::Knife::CookbookUpload do
it "should warn users that no cookbooks exist" do
knife.config[:cookbook_path] = "/chef-repo/cookbooks"
expect(knife.ui).to receive(:warn).with(
- /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./)
+ /Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./
+ )
knife.run
end
end
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index c59838478e..c463a36fb4 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -44,7 +44,9 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
let(:loader) do
Chef::Knife::SubcommandLoader::HashedCommandLoader.new(
File.join(CHEF_SPEC_DATA, "knife-site-subcommands"),
- plugin_manifest) end
+ plugin_manifest
+ )
+ end
describe "#list_commands" do
before do
diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
index a662b1c203..e5a4e955e8 100644
--- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
@@ -157,8 +157,7 @@ describe Chef::Knife::Core::WindowsBootstrapContext do
validation_client_name: "chef-validator-testing",
file_cache_path: "c:/chef/cache",
file_backup_path: "c:/chef/backup",
- cache_options: ({ path: "c:/chef/cache/checksums", skip_expires: true })
- ))
+ cache_options: ({ path: "c:/chef/cache/checksums", skip_expires: true })))
end
it "generates the config file data" do
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index 3bea392ae2..bc0ca330e8 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -77,7 +77,8 @@ describe Chef::Knife::DataBagFromFile do
"id" => "item_name",
"greeting" => "hello",
"nested" => { "a1" => [1, 2, 3], "a2" => { "b1" => true } },
- } end
+ }
+ end
let(:enc_data) { Chef::EncryptedDataBagItem.encrypt_data_bag_item(plain_data, secret) }
let(:rest) { double("Chef::ServerAPI") }
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index 8dd0669993..6ac6dd3c95 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -47,7 +47,8 @@ describe Chef::Knife::DataBagShow do
let(:data_bag_contents) do
{ "id" => "id", "baz" => "http://localhost:4000/data/bag_o_data/baz",
- "qux" => "http://localhost:4000/data/bag_o_data/qux" } end
+ "qux" => "http://localhost:4000/data/bag_o_data/qux" }
+ end
let(:enc_hash) { Chef::EncryptedDataBagItem.encrypt_data_bag_item(data_bag_contents, secret) }
let(:data_bag) { Chef::DataBagItem.from_hash(data_bag_contents) }
let(:data_bag_with_encoded_hash) { Chef::DataBagItem.from_hash(enc_hash) }
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index 929a0f742b..dc66007c32 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -40,7 +40,8 @@ describe Chef::Knife::Status do
{ filter_result:
{ name: ["name"], ipaddress: ["ipaddress"], ohai_time: ["ohai_time"],
ec2: ["ec2"], run_list: ["run_list"], platform: ["platform"],
- platform_version: ["platform_version"], chef_environment: ["chef_environment"] } } end
+ platform_version: ["platform_version"], chef_environment: ["chef_environment"] } }
+ end
it "should default to searching for everything" do
expect(@query).to receive(:search).with(:node, "*:*", opts)
diff --git a/spec/unit/knife/supermarket_install_spec.rb b/spec/unit/knife/supermarket_install_spec.rb
index 801fb74802..9c969106fc 100644
--- a/spec/unit/knife/supermarket_install_spec.rb
+++ b/spec/unit/knife/supermarket_install_spec.rb
@@ -28,7 +28,8 @@ describe Chef::Knife::SupermarketInstall do
let(:repo) do
double(sanity_check: true, reset_to_default_state: true,
prepare_to_import: true, finalize_updates_to: true,
- merge_updates_from: true) end
+ merge_updates_from: true)
+ end
let(:install_path) do
if Chef::Platform.windows?
"C:/tmp/chef"
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index bab6b579b5..6ed7ddd70e 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -166,7 +166,8 @@ describe Chef::Knife do
"X-Chef-Version" => Chef::VERSION,
"Host" => "api.opscode.piab",
"X-REMOTE-REQUEST-ID" => request_id,
- } end
+ }
+ end
let(:request_id) { "1234" }
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 6edf0963b8..cf6ab88eb4 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -36,7 +36,8 @@ describe Chef::Provider::DscResource do
it "raises a ProviderNotFound exception" do
expect(provider).not_to receive(:meta_configuration)
expect { provider.run_action(:run) }.to raise_error(
- Chef::Exceptions::ProviderNotFound, /5\.0\.10018\.0/)
+ Chef::Exceptions::ProviderNotFound, /5\.0\.10018\.0/
+ )
end
end
@@ -52,7 +53,8 @@ describe Chef::Provider::DscResource do
it "raises an exception" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(false)
expect { provider.run_action(:run) }.to raise_error(
- Chef::Exceptions::ProviderNotFound, /Disabled/)
+ Chef::Exceptions::ProviderNotFound, /Disabled/
+ )
end
end
context "and the WMF is 5 RTM or newer" do
@@ -157,7 +159,8 @@ describe Chef::Provider::DscResource do
[
{ "Module" => { "Name" => "ModuleName1", "Version" => "1.0.0.0" } },
{ "Module" => { "Name" => "ModuleName1", "Version" => "2.0.0.0" } },
- ] end
+ ]
+ end
it "raises MultipleDscResourcesFound" do
expect { provider.run_action(:run) }.to raise_error(Chef::Exceptions::MultipleDscResourcesFound)
diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb
index 94322a89f9..910470b1b7 100644
--- a/spec/unit/provider/group/dscl_spec.rb
+++ b/spec/unit/provider/group/dscl_spec.rb
@@ -121,7 +121,7 @@ describe Chef::Provider::Group::Dscl do
500
)
EOS
- )
+ )
end
it "should run safe_dscl with search /Groups gid" do
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb
index 87391b6288..d7fdfb299c 100644
--- a/spec/unit/provider/group_spec.rb
+++ b/spec/unit/provider/group_spec.rb
@@ -39,8 +39,7 @@ describe Chef::Provider::User do
@pw_group = double("Struct::Group",
name: "wheel",
gid: 20,
- mem: %w{root aj}
- )
+ mem: %w{root aj})
allow(Etc).to receive(:getgrnam).with("wheel").and_return(@pw_group)
end
diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb
index 8b5edc68b5..53b56b4960 100644
--- a/spec/unit/provider/launchd_spec.rb
+++ b/spec/unit/provider/launchd_spec.rb
@@ -89,7 +89,8 @@ describe Chef::Provider::Launchd do
"Weekday" => 7,
},
"TimeOut" => 300,
- } end
+ }
+ end
before(:each) do
provider.load_current_resource
@@ -197,9 +198,11 @@ describe Chef::Provider::Launchd do
describe "and the file has been updated" do
before(:each) do
allow(provider).to receive(
- :manage_plist).with(:create).and_return(true)
+ :manage_plist
+ ).with(:create).and_return(true)
allow(provider).to receive(
- :manage_service).with(:restart).and_return(true)
+ :manage_service
+ ).with(:restart).and_return(true)
end
it "should call manage_service with a :restart action" do
@@ -215,9 +218,11 @@ describe Chef::Provider::Launchd do
describe "and the file has not been updated" do
before(:each) do
allow(provider).to receive(
- :manage_plist).with(:create).and_return(nil)
+ :manage_plist
+ ).with(:create).and_return(nil)
allow(provider).to receive(
- :manage_service).with(:enable).and_return(true)
+ :manage_service
+ ).with(:enable).and_return(true)
end
it "should call manage_service with a :enable action" do
@@ -236,9 +241,11 @@ describe Chef::Provider::Launchd do
before(:each) do
allow(File).to receive(:exists?).and_return(true)
allow(provider).to receive(
- :manage_service).with(:disable).and_return(true)
+ :manage_service
+ ).with(:disable).and_return(true)
allow(provider).to receive(
- :manage_plist).with(:delete).and_return(true)
+ :manage_plist
+ ).with(:delete).and_return(true)
end
it "should call manage_service with a :disable action" do
@@ -255,7 +262,8 @@ describe Chef::Provider::Launchd do
before(:each) do
allow(File).to receive(:exists?).and_return(false)
allow(provider).to receive(
- :manage_plist).with(:delete).and_return(true)
+ :manage_plist
+ ).with(:delete).and_return(true)
end
it "works with action :delete" do
diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb
index 027b318c7e..fff2c1ffa8 100644
--- a/spec/unit/provider/link_spec.rb
+++ b/spec/unit/provider/link_spec.rb
@@ -259,7 +259,8 @@ describe Chef::Resource::Link do
allow(stat).to receive(:gid).and_return(501)
allow(stat).to receive(:mode).and_return(0755)
allow(provider.file_class).to receive(:stat).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(stat)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(stat)
provider.load_current_resource
end
@@ -267,7 +268,8 @@ describe Chef::Resource::Link do
shared_context "delete link to directories on Windows" do
before do
allow(::File).to receive(:directory?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(true)
end
it "invokes Dir.delete method to delete the link" do
@@ -280,7 +282,8 @@ describe Chef::Resource::Link do
shared_context "delete link to directories on Linux" do
before do
allow(::File).to receive(:directory?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(true)
end
it "invokes File.delete method to delete the link" do
@@ -293,7 +296,8 @@ describe Chef::Resource::Link do
shared_context "delete link to files" do
before do
allow(::File).to receive(:directory?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(false)
end
it "invokes File.delete method to delete the link" do
@@ -306,9 +310,11 @@ describe Chef::Resource::Link do
shared_context "soft links prerequisites" do
before(:each) do
allow(provider.file_class).to receive(:symlink?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(true)
allow(provider.file_class).to receive(:readlink).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return("#{CHEF_SPEC_DATA}/fofile")
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return("#{CHEF_SPEC_DATA}/fofile")
end
end
@@ -327,15 +333,19 @@ describe Chef::Resource::Link do
allow(stat).to receive(:mode).and_return(0644)
allow(provider.file_class).to receive(:symlink?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(false)
allow(File).to receive(:exists?).with(
- "#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
+ "#{CHEF_SPEC_DATA}/fofile-link"
+ ).and_return(true)
allow(File).to receive(:exists?).with(
- "#{CHEF_SPEC_DATA}/fofile").and_return(true)
+ "#{CHEF_SPEC_DATA}/fofile"
+ ).and_return(true)
allow(provider.file_class).to receive(:stat).with(
- "#{CHEF_SPEC_DATA}/fofile").and_return(stat)
+ "#{CHEF_SPEC_DATA}/fofile"
+ ).and_return(stat)
end
end
@@ -346,7 +356,8 @@ describe Chef::Resource::Link do
before(:each) do
allow(Chef::Resource::Link).to receive(:new).with(
- provider.new_resource.name).and_return(resource_link)
+ provider.new_resource.name
+ ).and_return(resource_link)
allow(resource_link).to receive(:verify_links_supported!)
allow(Chef::Platform).to receive(:windows?).and_return(true)
end
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index a7eaf4cd55..017041bc60 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -132,7 +132,7 @@ describe Chef::Provider::OsxProfile do
provider.load_current_resource
expect(
provider.instance_variable_get(:@new_profile_identifier)
- ).to eql(test_profile["PayloadIdentifier"])
+ ).to eql(test_profile["PayloadIdentifier"])
end
it "should install when not installed" do
@@ -228,16 +228,14 @@ describe Chef::Provider::OsxProfile do
new_resource.profile_name "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
- expect(provider.instance_variable_get(:@new_profile_identifier)
- ).to eql(new_resource.profile_name)
+ expect(provider.instance_variable_get(:@new_profile_identifier)).to eql(new_resource.profile_name)
end
it "should use specified identifier" do
new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
- expect(provider.instance_variable_get(:@new_profile_identifier)
- ).to eql(new_resource.identifier)
+ expect(provider.instance_variable_get(:@new_profile_identifier)).to eql(new_resource.identifier)
end
it "should work with spaces in the identifier" do
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb
index bfc78cbb7f..b2c051d2f1 100644
--- a/spec/unit/provider/package/apt_spec.rb
+++ b/spec/unit/provider/package/apt_spec.rb
@@ -511,8 +511,8 @@ describe Chef::Provider::Package::Apt do
allow(@provider).to receive(:shell_out_compacted!).with(
"apt-mark", "showhold", timeout: 900
).and_return(instance_double(
- Mixlib::ShellOut, stdout: "irssi")
- )
+ Mixlib::ShellOut, stdout: "irssi"
+ ))
expect(logger).to receive(:trace).with("#{@provider.new_resource} is already locked")
@provider.action_lock
@@ -532,8 +532,8 @@ describe Chef::Provider::Package::Apt do
allow(@provider).to receive(:shell_out_compacted!).with(
"apt-mark", "showhold", timeout: 900
).and_return(instance_double(
- Mixlib::ShellOut, stdout: "")
- )
+ Mixlib::ShellOut, stdout: ""
+ ))
expect(logger).to receive(:trace).with("#{@provider.new_resource} is already unlocked")
@provider.action_unlock
diff --git a/spec/unit/provider/package/openbsd_spec.rb b/spec/unit/provider/package/openbsd_spec.rb
index 48e4b12a72..c8de4b7471 100644
--- a/spec/unit/provider/package/openbsd_spec.rb
+++ b/spec/unit/provider/package/openbsd_spec.rb
@@ -53,7 +53,8 @@ describe Chef::Provider::Package::Openbsd do
context "when source is not provided" do
it "should run the installation command" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything).and_return(
- instance_double("shellout", stdout: "#{name}-#{version}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}\n")
+ )
expect(provider).to receive(:shell_out_compacted!).with(
"pkg_add", "-r", "#{name}-#{version}",
{ env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
@@ -70,7 +71,8 @@ describe Chef::Provider::Package::Openbsd do
context "if no version is specified" do
it "should raise an exception" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything).and_return(
- instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n")
+ )
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /multiple matching candidates/)
end
end
@@ -85,7 +87,8 @@ describe Chef::Provider::Package::Openbsd do
it "should run the installation command" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-e", "#{package_name}->0", anything).and_return(instance_double("shellout", stdout: ""))
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything).and_return(
- instance_double("shellout", stdout: "#{name}-#{version}-#{flavor}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor}\n")
+ )
expect(provider).to receive(:shell_out_compacted!).with(
"pkg_add", "-r", "#{name}-#{version}-#{flavor}",
{ env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
@@ -99,7 +102,8 @@ describe Chef::Provider::Package::Openbsd do
context "if a version is specified" do
it "should use the flavor from the version" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", "#{name}-#{version}-#{flavor_b}", anything).and_return(
- instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n")
+ )
new_resource.version("#{version}-#{flavor_b}")
expect(provider).to receive(:shell_out_compacted!).with(
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index 6b85013f3d..2fafb3bd0e 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -436,7 +436,8 @@ describe Chef::Provider::Package::Windows, :windows_only do
it "raises the checksum mismatch exception" do
expect { provider.send(:validate_content!) }.to raise_error(
- Chef::Exceptions::ChecksumMismatch)
+ Chef::Exceptions::ChecksumMismatch
+ )
end
end
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 626abb10f7..5f89605b2e 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -89,7 +89,8 @@ describe Chef::Provider::Service::Debian do
"0" => [:stop, "20"],
"1" => [:stop, "20"],
"6" => [:stop, "20"],
- })
+ }
+ )
end
end
diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb
index 3fb7a0de87..4392786edc 100644
--- a/spec/unit/provider/service/freebsd_service_spec.rb
+++ b/spec/unit/provider/service/freebsd_service_spec.rb
@@ -261,7 +261,8 @@ describe Chef::Provider::Service::Freebsd do
[
%Q{thing_#{new_resource.service_name}_enable="YES"},
%Q{#{new_resource.service_name}_enable="NO"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be false
@@ -273,7 +274,8 @@ describe Chef::Provider::Service::Freebsd do
[
%Q{#{new_resource.service_name}_thing_enable="YES"},
%Q{#{new_resource.service_name}_enable="NO"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be false
@@ -285,7 +287,8 @@ describe Chef::Provider::Service::Freebsd do
[
%Q{thing_#{new_resource.service_name}_enable="NO"},
%Q{#{new_resource.service_name}_enable="YES"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (true)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be true
@@ -297,7 +300,8 @@ describe Chef::Provider::Service::Freebsd do
[
%Q{#{new_resource.service_name}_thing_enable="NO"},
%Q{#{new_resource.service_name}_enable="YES"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (true)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be true
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 9cb8a2b5dc..dfa491fc38 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -178,7 +178,8 @@ describe Chef::Provider::Service::Openbsd do
[
%Q{thing_#{provider.builtin_service_enable_variable_name}="YES"},
%Q{#{provider.builtin_service_enable_variable_name}="NO"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be false
@@ -190,7 +191,8 @@ describe Chef::Provider::Service::Openbsd do
[
%Q{#{provider.builtin_service_enable_variable_name}_thing="YES"},
(provider.builtin_service_enable_variable_name).to_s,
- ] end
+ ]
+ end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be false
@@ -202,7 +204,8 @@ describe Chef::Provider::Service::Openbsd do
[
%Q{thing_#{provider.builtin_service_enable_variable_name}="NO"},
%Q{#{provider.builtin_service_enable_variable_name}="YES"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (true)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be true
@@ -214,7 +217,8 @@ describe Chef::Provider::Service::Openbsd do
[
%Q{#{provider.builtin_service_enable_variable_name}_thing="NO"},
%Q{#{provider.builtin_service_enable_variable_name}="YES"},
- ] end
+ ]
+ end
it "sets enabled based on the exact match (true)" do
provider.determine_enabled_status!
expect(current_resource.enabled).to be true
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 8cda32973e..860c0b1d6a 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -41,8 +41,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
tag_id: 0,
dependencies: ["Winmgmt"],
service_start_name: "LocalSystem",
- display_name: "Chef Client Service"
- )
+ display_name: "Chef Client Service")
end
# Actual response from Win32::Service.services
@@ -73,8 +72,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
command: nil,
num_actions: 0,
actions: nil,
- delayed_start: 1
- )
+ delayed_start: 1)
end
let(:provider) do
@@ -98,7 +96,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
allow(Win32::Service).to receive(:start).with(any_args).and_return(Win32::Service)
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name)
.and_return(chef_service_config_info)
@@ -155,8 +154,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
tag_id: 0,
dependencies: %w{NSI Tdx Afd},
service_start_name: 'NT Authority\\LocalService',
- display_name: "DHCP Client"
- ))
+ display_name: "DHCP Client")
+ )
end
context "startup_type is neither :automatic or :disabled" do
@@ -171,8 +170,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
tag_id: 0,
dependencies: %w{NSI Tdx Afd},
service_start_name: 'NT Authority\\LocalService',
- display_name: "DHCP Client"
- ))
+ display_name: "DHCP Client")
+ )
end
it "does not set the current resources enabled" do
@@ -473,7 +472,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
before(:each) do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
double("StatusStruct", current_state: "stopped"),
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
end
context "run_as_user user is specified" do
@@ -555,7 +555,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "does nothing if the service is running" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
provider.start_service
@@ -565,7 +566,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
context "service is paused" do
before do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "paused"))
+ double("StatusStruct", current_state: "paused")
+ )
provider.load_current_resource
end
@@ -590,7 +592,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
double("StatusStruct", current_state: "start pending"),
double("StatusStruct", current_state: "start pending"),
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
provider.load_current_resource
end
@@ -614,7 +617,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
context "service is in stop_pending" do
before do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "stop pending"))
+ double("StatusStruct", current_state: "stop pending")
+ )
provider.load_current_resource
end
@@ -665,7 +669,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
before(:each) do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
double("StatusStruct", current_state: "running"),
- double("StatusStruct", current_state: "stopped"))
+ double("StatusStruct", current_state: "stopped")
+ )
end
it "calls the stop command if one is specified" do
@@ -690,7 +695,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "does nothing if the service is stopped" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "stopped"))
+ double("StatusStruct", current_state: "stopped")
+ )
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
provider.stop_service
@@ -699,7 +705,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "raises an error if the service is paused" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "paused"))
+ double("StatusStruct", current_state: "paused")
+ )
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
expect { provider.stop_service }.to raise_error( Chef::Exceptions::Service )
@@ -710,7 +717,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
double("StatusStruct", current_state: "stop pending"),
double("StatusStruct", current_state: "stop pending"),
- double("StatusStruct", current_state: "stopped"))
+ double("StatusStruct", current_state: "stopped")
+ )
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
provider.stop_service
@@ -719,7 +727,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "fails if the service is in start_pending" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "start pending"))
+ double("StatusStruct", current_state: "start pending")
+ )
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
expect { provider.stop_service }.to raise_error( Chef::Exceptions::Service )
@@ -728,7 +737,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "passes custom timeout to the stop command if provided" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
new_resource.timeout 1
expect(Win32::Service).to receive(:stop).with(new_resource.service_name)
Timeout.timeout(2) do
@@ -753,7 +763,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
double("StatusStruct", current_state: "running"),
double("StatusStruct", current_state: "stopped"),
double("StatusStruct", current_state: "stopped"),
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
expect(Win32::Service).to receive(:stop).with(new_resource.service_name)
expect(Win32::Service).to receive(:start).with(new_resource.service_name)
provider.restart_service
@@ -764,7 +775,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
double("StatusStruct", current_state: "stopped"),
double("StatusStruct", current_state: "stopped"),
- double("StatusStruct", current_state: "running"))
+ double("StatusStruct", current_state: "running")
+ )
expect(Win32::Service).to receive(:start).with(new_resource.service_name)
provider.restart_service
expect(new_resource).to be_updated_by_last_action
@@ -783,7 +795,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "enable_service" do
before(:each) do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "disabled"))
+ double("ConfigStruct", start_type: "disabled")
+ )
end
it "enables service" do
@@ -803,14 +816,16 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "action_enable" do
it "does nothing if the service is enabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "auto start"))
+ double("ConfigStruct", start_type: "auto start")
+ )
expect(provider).not_to receive(:enable_service)
provider.action_enable
end
it "enables the service if it is not set to automatic start" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "disabled"))
+ double("ConfigStruct", start_type: "disabled")
+ )
expect(provider).to receive(:enable_service)
provider.action_enable
end
@@ -819,14 +834,16 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "action_disable" do
it "does nothing if the service is disabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "disabled"))
+ double("ConfigStruct", start_type: "disabled")
+ )
expect(provider).not_to receive(:disable_service)
provider.action_disable
end
it "disables the service if it is not set to disabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "auto start"))
+ double("ConfigStruct", start_type: "auto start")
+ )
expect(provider).to receive(:disable_service)
provider.action_disable
end
@@ -835,7 +852,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "disable_service" do
before(:each) do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", start_type: "auto start"))
+ double("ConfigStruct", start_type: "auto start")
+ )
end
it "disables service" do
diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb
index d3c5073b7e..a70b7cd48b 100644
--- a/spec/unit/provider/subversion_spec.rb
+++ b/spec/unit/provider/subversion_spec.rb
@@ -277,7 +277,8 @@ describe Chef::Provider::Subversion do
allow(ChefConfig).to receive(:windows?) { false }
expect(@provider).to receive(:svn_binary).and_return("svn")
expect(@provider.export_command).to eql(
- "svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
+ "svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir"
+ )
end
it "selects an svn binary with an exe extension on windows" do
@@ -285,21 +286,24 @@ describe Chef::Provider::Subversion do
allow(ChefConfig).to receive(:windows?) { true }
expect(@provider).to receive(:svn_binary).and_return("svn.exe")
expect(@provider.export_command).to eql(
- "svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
+ "svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir"
+ )
end
it "uses a custom svn binary as part of the svn command" do
@resource.svn_binary "teapot"
expect(@provider).to receive(:svn_binary).and_return("teapot")
expect(@provider.export_command).to eql(
- "teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
+ "teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir"
+ )
end
it "wraps custom svn binary with quotes if it contains whitespace" do
@resource.svn_binary "c:/program files (x86)/subversion/svn.exe"
expect(@provider).to receive(:svn_binary).and_return("c:/program files (x86)/subversion/svn.exe")
expect(@provider.export_command).to eql(
- '"c:/program files (x86)/subversion/svn.exe" export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ '"c:/program files (x86)/subversion/svn.exe" export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir'
+ )
end
end
diff --git a/spec/unit/resource/osx_profile_spec.rb b/spec/unit/resource/osx_profile_spec.rb
index 41a6071893..5653044358 100644
--- a/spec/unit/resource/osx_profile_spec.rb
+++ b/spec/unit/resource/osx_profile_spec.rb
@@ -21,7 +21,8 @@ require "spec_helper"
describe Chef::Resource::OsxProfile do
let(:resource) do
Chef::Resource::OsxProfile.new(
- "fakey_fakerton")
+ "fakey_fakerton"
+ )
end
it "has a resource name of profile" do
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index 34d530c1a2..5566f32725 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -87,7 +87,8 @@ describe Chef::Resource::PowershellScript do
it "enables convert_boolean_return by default for guards in the context of powershell_script when no guard params are specified" do
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:evaluate_action).and_return(true)
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }
+ ).and_return(Proc.new {})
resource.only_if("$true")
end
@@ -98,21 +99,24 @@ describe Chef::Resource::PowershellScript do
file_resource.guard_interpreter :powershell_script
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }
+ ).and_return(Proc.new {})
resource.only_if("$true")
end
it "enables convert_boolean_return by default for guards in the context of powershell_script when guard params are specified" do
guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 }
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)
+ ).and_return(Proc.new {})
resource.only_if("$true", guard_parameters)
end
it "passes convert_boolean_return as true if it was specified as true in a guard parameter" do
guard_parameters = { cwd: "/etc/chef", convert_boolean_return: true, architecture: :x86_64 }
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)
+ ).and_return(Proc.new {})
resource.only_if("$true", guard_parameters)
end
@@ -120,7 +124,8 @@ describe Chef::Resource::PowershellScript do
other_guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 }
parameters_with_boolean_disabled = other_guard_parameters.merge({ convert_boolean_return: false, code: "$true" })
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- parameters_with_boolean_disabled).and_return(Proc.new {})
+ parameters_with_boolean_disabled
+ ).and_return(Proc.new {})
resource.only_if("$true", parameters_with_boolean_disabled)
end
end
diff --git a/spec/unit/run_list/run_list_expansion_spec.rb b/spec/unit/run_list/run_list_expansion_spec.rb
index 42018a07ba..4ddc75f002 100644
--- a/spec/unit/run_list/run_list_expansion_spec.rb
+++ b/spec/unit/run_list/run_list_expansion_spec.rb
@@ -95,11 +95,14 @@ describe Chef::RunList::RunListExpansion do
@expansion.expand
@json = '{"id":"_default","run_list":[{"type":"recipe","name":"lobster::mastercookbook","version":"0.1.0",'
.concat(
-'"skipped":false},{"type":"role","name":"rage","children":[{"type":"role","name":"mollusk","children":[],"missing":null,'
- .concat(
-'"error":null,"skipped":null},{"type":"recipe","name":"crabrevenge","version":null,"skipped":false}],"missing":null,'
- .concat(
-'"error":null,"skipped":null},{"type":"recipe","name":"fist","version":"0.1","skipped":false}]}')))
+ '"skipped":false},{"type":"role","name":"rage","children":[{"type":"role","name":"mollusk","children":[],"missing":null,'
+ .concat(
+ '"error":null,"skipped":null},{"type":"recipe","name":"crabrevenge","version":null,"skipped":false}],"missing":null,'
+ .concat(
+ '"error":null,"skipped":null},{"type":"recipe","name":"fist","version":"0.1","skipped":false}]}'
+ )
+ )
+ )
end
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index 641e8558ad..83f988911c 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -149,7 +149,8 @@ describe Chef::Search::Query do
],
"start" => 0,
"total" => 4,
- } end
+ }
+ end
let(:big_response_empty) do
{
diff --git a/spec/unit/shell/shell_session_spec.rb b/spec/unit/shell/shell_session_spec.rb
index 6644ff6e0c..c98989491d 100644
--- a/spec/unit/shell/shell_session_spec.rb
+++ b/spec/unit/shell/shell_session_spec.rb
@@ -57,8 +57,7 @@ describe Shell::ClientSession do
load_node: true,
build_node: true,
register: true,
- sync_cookbooks: {}
- )
+ sync_cookbooks: {})
end
before do
@@ -94,8 +93,7 @@ describe Shell::SoloSession do
load_node: true,
build_node: true,
register: true,
- sync_cookbooks: {}
- )
+ sync_cookbooks: {})
end
before do
@@ -132,8 +130,7 @@ describe Shell::StandAloneSession do
load_node: true,
build_node: true,
register: true,
- sync_cookbooks: {}
- )
+ sync_cookbooks: {})
end
let(:recipe) { Chef::Recipe.new(nil, nil, run_context) }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
diff --git a/spec/unit/util/powershell/ps_credential_spec.rb b/spec/unit/util/powershell/ps_credential_spec.rb
index 6f65174d15..65207d5dfb 100644
--- a/spec/unit/util/powershell/ps_credential_spec.rb
+++ b/spec/unit/util/powershell/ps_credential_spec.rb
@@ -29,8 +29,9 @@ describe Chef::Util::Powershell::PSCredential do
it "should create the script to create a PSCredential when calling" do
allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
expect(ps_credential.to_psobject).to eq(
- "New-Object System.Management.Automation.PSCredential("\
- "'#{username}',('encrypted' | ConvertTo-SecureString))")
+ "New-Object System.Management.Automation.PSCredential("\
+ "'#{username}',('encrypted' | ConvertTo-SecureString))"
+ )
end
end
diff --git a/spec/unit/win32/security_spec.rb b/spec/unit/win32/security_spec.rb
index 3c612aef10..efbb290adf 100644
--- a/spec/unit/win32/security_spec.rb
+++ b/spec/unit/win32/security_spec.rb
@@ -98,7 +98,8 @@ describe "Chef::Win32::Security", :windows_only do
let(:token) do
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
- token_rights)
+ token_rights
+ )
end
it "raises error if GetTokenInformation fails" do