diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
commit | 686113531d23f30e9973d659c456ae33eb9cff1f (patch) | |
tree | f225de7251a8b49b8d183dd168bab0a0addbe23f /spec/support/shared/functional | |
parent | d1cf34b059a16a81e0fc48de52ba29863bb41fe6 (diff) | |
download | chef-686113531d23f30e9973d659c456ae33eb9cff1f.tar.gz |
autofixing whitespace cops
4174 Style/SpaceInsideHashLiteralBraces
1860 Style/SpaceAroundOperators
1336 Style/SpaceInsideBlockBraces
1292 Style/AlignHash
997 Style/SpaceAfterComma
860 Style/SpaceAroundEqualsInParameterDefault
310 Style/EmptyLines
294 Style/IndentationConsistency
267 Style/TrailingWhitespace
238 Style/ExtraSpacing
212 Style/SpaceBeforeBlockBraces
166 Style/MultilineOperationIndentation
144 Style/TrailingBlankLines
120 Style/EmptyLineBetweenDefs
101 Style/IndentationWidth
82 Style/SpaceAroundBlockParameters
40 Style/EmptyLinesAroundMethodBody
29 Style/EmptyLinesAroundAccessModifier
1 Style/RescueEnsureAlignment
Diffstat (limited to 'spec/support/shared/functional')
8 files changed, 21 insertions, 31 deletions
diff --git a/spec/support/shared/functional/diff_disabled.rb b/spec/support/shared/functional/diff_disabled.rb index 7ee9808a94..c40b1e6e49 100644 --- a/spec/support/shared/functional/diff_disabled.rb +++ b/spec/support/shared/functional/diff_disabled.rb @@ -1,5 +1,5 @@ -shared_context "diff disabled" do +shared_context "diff disabled" do before do Chef::Config[:diff_disabled] = true end diff --git a/spec/support/shared/functional/directory_resource.rb b/spec/support/shared/functional/directory_resource.rb index 88e716b498..084cd43009 100644 --- a/spec/support/shared/functional/directory_resource.rb +++ b/spec/support/shared/functional/directory_resource.rb @@ -20,7 +20,7 @@ shared_examples_for "a directory resource" do include_context "diff disabled" - let(:expect_updated?) {true} + let(:expect_updated?) { true } context "when the target directory does not exist" do before do diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb index c7a9611786..5f34f1efe6 100644 --- a/spec/support/shared/functional/file_resource.rb +++ b/spec/support/shared/functional/file_resource.rb @@ -44,7 +44,6 @@ shared_context "deploying via destdir" do end end - shared_examples_for "a file with the wrong content" do before do # Assert starting state is as expected @@ -103,7 +102,7 @@ shared_examples_for "a file with the wrong content" do end it "raises an exception" do - expect{ resource.run_action(:create) }.to raise_error(Chef::Exceptions::ChecksumMismatch) + expect { resource.run_action(:create) }.to raise_error(Chef::Exceptions::ChecksumMismatch) end end end @@ -308,14 +307,14 @@ shared_examples_for "a file resource" do describe "when setting atomic_update" do it "booleans should work" do - expect {resource.atomic_update(true)}.not_to raise_error - expect {resource.atomic_update(false)}.not_to raise_error + expect { resource.atomic_update(true) }.not_to raise_error + expect { resource.atomic_update(false) }.not_to raise_error end it "anything else should raise an error" do - expect {resource.atomic_update(:copy)}.to raise_error(ArgumentError) - expect {resource.atomic_update(:move)}.to raise_error(ArgumentError) - expect {resource.atomic_update(958)}.to raise_error(ArgumentError) + expect { resource.atomic_update(:copy) }.to raise_error(ArgumentError) + expect { resource.atomic_update(:move) }.to raise_error(ArgumentError) + expect { resource.atomic_update(958) }.to raise_error(ArgumentError) end end @@ -351,13 +350,13 @@ shared_examples_for "file resource not pointing to a real file" do describe "when force_unlink is set to false" do it ":create raises an error" do - expect {resource.run_action(:create) }.to raise_error(Chef::Exceptions::FileTypeMismatch) + expect { resource.run_action(:create) }.to raise_error(Chef::Exceptions::FileTypeMismatch) end end describe "when force_unlink is not set (default)" do it ":create raises an error" do - expect {resource.run_action(:create) }.to raise_error(Chef::Exceptions::FileTypeMismatch) + expect { resource.run_action(:create) }.to raise_error(Chef::Exceptions::FileTypeMismatch) end end end @@ -405,7 +404,6 @@ shared_examples_for "a configured file resource" do File.join(CHEF_SPEC_DATA, "file-test-target") } - describe "when configured not to manage symlink's target" do before(:each) do # configure not to manage symlink source @@ -574,7 +572,6 @@ shared_examples_for "a configured file resource" do File.open(path, "wb") { |f| f.write(expected_content) } end - include_context "setup broken permissions" include_examples "a securable resource with existing target" @@ -721,7 +718,7 @@ shared_examples_for "a configured file resource" do it_behaves_like "file resource not pointing to a real file" end - context "when the target file is a blockdev",:unix_only, :requires_root, :not_supported_on_solaris do + context "when the target file is a blockdev", :unix_only, :requires_root, :not_supported_on_solaris do include Chef::Mixin::ShellOut let(:path) do File.join(CHEF_SPEC_DATA, "testdev") @@ -739,7 +736,7 @@ shared_examples_for "a configured file resource" do it_behaves_like "file resource not pointing to a real file" end - context "when the target file is a chardev",:unix_only, :requires_root, :not_supported_on_solaris do + context "when the target file is a chardev", :unix_only, :requires_root, :not_supported_on_solaris do include Chef::Mixin::ShellOut let(:path) do File.join(CHEF_SPEC_DATA, "testdev") @@ -757,7 +754,7 @@ shared_examples_for "a configured file resource" do it_behaves_like "file resource not pointing to a real file" end - context "when the target file is a pipe",:unix_only do + context "when the target file is a pipe", :unix_only do include Chef::Mixin::ShellOut let(:path) do File.join(CHEF_SPEC_DATA, "testpipe") @@ -775,7 +772,7 @@ shared_examples_for "a configured file resource" do it_behaves_like "file resource not pointing to a real file" end - context "when the target file is a socket",:unix_only do + context "when the target file is a socket", :unix_only do require "socket" # It turns out that the path to a socket can have at most ~104 @@ -1018,7 +1015,7 @@ shared_examples_for "a configured file resource" do end -shared_context Chef::Resource::File do +shared_context Chef::Resource::File do if windows? require "chef/win32/file" end diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb index 2779730268..8e6b5bfa89 100644 --- a/spec/support/shared/functional/http.rb +++ b/spec/support/shared/functional/http.rb @@ -37,7 +37,7 @@ module ChefHTTPShared content end - def start_tiny_server(server_opts={}) + def start_tiny_server(server_opts = {}) nyan_uncompressed_size = File::Stat.new(nyan_uncompressed_filename).size nyan_compressed_size = File::Stat.new(nyan_compressed_filename).size @@ -162,7 +162,6 @@ module ChefHTTPShared # @api.get("/bad_request", 400, '{ "error": [ "Your request is just terrible." ] }') @api.post("/bad_request", 400, '{ "error": [ "Your request is just terrible." ] }') - end def stop_tiny_server diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb index 330183ebb1..dd8a0216bc 100644 --- a/spec/support/shared/functional/securable_resource.rb +++ b/spec/support/shared/functional/securable_resource.rb @@ -515,7 +515,7 @@ shared_examples_for "a securable resource without existing target" do resource.inherits(false) resource.run_action(:create) - descriptor.dacl.each do | ace | + descriptor.dacl.each do |ace| expect(ace.inherited?).to eq(false) end end diff --git a/spec/support/shared/functional/securable_resource_with_reporting.rb b/spec/support/shared/functional/securable_resource_with_reporting.rb index c9b5bae465..0bec29783a 100644 --- a/spec/support/shared/functional/securable_resource_with_reporting.rb +++ b/spec/support/shared/functional/securable_resource_with_reporting.rb @@ -21,7 +21,6 @@ ALL_EXPANDED_PERMISSIONS = ["generic read", "read attributes", "write attributes"] - shared_examples_for "a securable resource with reporting" do include_context "diff disabled" @@ -273,7 +272,6 @@ shared_examples_for "a securable resource with reporting" do # Windows reporting data should look like this (+/- ish): # { "owner" => "bob", "checksum" => "ffff", "access control" => { "bob" => { "permissions" => ["perm1", "perm2", ...], "flags" => [] }}} - before do resource.action(:create) end @@ -293,14 +291,13 @@ shared_examples_for "a securable resource with reporting" do resource.run_action(:create) # TODO: most stable way to specify? expect(resource.owner).to eq(etc.getpwuid(process.uid).name) - expect(resource.state[:expanded_rights]).to eq({ "CURRENTUSER" => { "permissions" => ALL_EXPANDED_PERMISSIONS, "flags" => [] }}) + expect(resource.state[:expanded_rights]).to eq({ "CURRENTUSER" => { "permissions" => ALL_EXPANDED_PERMISSIONS, "flags" => [] } }) expect(resource.state[:expanded_deny_rights]).to eq({}) expect(resource.state[:inherits]).to be_truthy end end - - context "and owner is specified with a string (username) in new_resource" do + context "and owner is specified with a string (username) in new_resource" do # TODO/bug: duplicated from the "securable resource" tests let(:expected_user_name) { "Guest" } @@ -392,7 +389,6 @@ shared_examples_for "a securable resource with reporting" do end end - end end end diff --git a/spec/support/shared/functional/win32_service.rb b/spec/support/shared/functional/win32_service.rb index 5bd2d772cb..0f9072bdef 100644 --- a/spec/support/shared/functional/win32_service.rb +++ b/spec/support/shared/functional/win32_service.rb @@ -35,10 +35,8 @@ shared_context "using Win32::Service" do if File.exists?(test_service_file) File.delete(test_service_file) end - end - # Definition for the test-service let(:test_service) { diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb index cad0d7e12d..67a53306ba 100644 --- a/spec/support/shared/functional/windows_script.rb +++ b/spec/support/shared/functional/windows_script.rb @@ -27,7 +27,7 @@ shared_context Chef::Resource::WindowsScript do @ohai_reader.all_plugins(["platform", "kernel"]) new_node = Chef::Node.new - new_node.consume_external_attrs(@ohai_reader.data,{}) + new_node.consume_external_attrs(@ohai_reader.data, {}) events = Chef::EventDispatch::Dispatcher.new @@ -116,7 +116,7 @@ shared_context Chef::Resource::WindowsScript do let (:guard_architecture) { :i386 } it "raises an error" do resource.only_if resource_guard_command, :architecture => guard_architecture - expect{ resource.run_action(:run) }.to raise_error( + expect { resource.run_action(:run) }.to raise_error( Chef::Exceptions::Win32ArchitectureIncorrect, /cannot execute script with requested architecture 'i386' on Windows Nano Server/) end |