diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 13:26:53 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 13:26:53 -0700 |
commit | 3b10f9ca503dcbce747241281b9151d3d010f9ef (patch) | |
tree | 2e90f78a6910a4c673e19045a7f0627f1fc49382 /spec/support/shared/functional | |
parent | 2a4916b7f01940d1199c35645c1b2172f5bd74b2 (diff) | |
download | chef-3b10f9ca503dcbce747241281b9151d3d010f9ef.tar.gz |
Style/SymbolProc
enforce pretzels.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support/shared/functional')
-rw-r--r-- | spec/support/shared/functional/file_resource.rb | 4 | ||||
-rw-r--r-- | spec/support/shared/functional/http.rb | 36 | ||||
-rw-r--r-- | spec/support/shared/functional/securable_resource.rb | 10 |
3 files changed, 13 insertions, 37 deletions
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb index db947614b3..114971641d 100644 --- a/spec/support/shared/functional/file_resource.rb +++ b/spec/support/shared/functional/file_resource.rb @@ -392,9 +392,7 @@ shared_examples_for "a configured file resource" do end def binread(file) - content = File.open(file, "rb") do |f| - f.read - end + content = File.open(file, "rb", &:read) content.force_encoding(Encoding::BINARY) if "".respond_to?(:force_encoding) content end diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb index 7450f28e35..58189e543f 100644 --- a/spec/support/shared/functional/http.rb +++ b/spec/support/shared/functional/http.rb @@ -30,9 +30,7 @@ module ChefHTTPShared end def binread(file) - content = File.open(file, "rb") do |f| - f.read - end + content = File.open(file, "rb", &:read) content.force_encoding(Encoding::BINARY) if "".respond_to?(:force_encoding) content end @@ -53,25 +51,19 @@ module ChefHTTPShared # just a normal file # (expected_content should be uncompressed) @api.get("/nyan_cat.png", 200) do - File.open(nyan_uncompressed_filename, "rb") do |f| - f.read - end + File.open(nyan_uncompressed_filename, "rb", &:read) end # this ends in .gz, we do not uncompress it and drop it on the filesystem as a .gz file (the internet often lies) # (expected_content should be compressed) @api.get("/nyan_cat.png.gz", 200, nil, { "Content-Type" => "application/gzip", "Content-Encoding" => "gzip" } ) do - File.open(nyan_compressed_filename, "rb") do |f| - f.read - end + File.open(nyan_compressed_filename, "rb", &:read) end # this is an uncompressed file that was compressed by some mod_gzip-ish webserver thingy, so we will expand it # (expected_content should be uncompressed) @api.get("/nyan_cat_compressed.png", 200, nil, { "Content-Type" => "application/gzip", "Content-Encoding" => "gzip" } ) do - File.open(nyan_compressed_filename, "rb") do |f| - f.read - end + File.open(nyan_compressed_filename, "rb", &:read) end # @@ -84,9 +76,7 @@ module ChefHTTPShared "Content-Length" => nyan_uncompressed_size.to_s, } ) do - File.open(nyan_uncompressed_filename, "rb") do |f| - f.read - end + File.open(nyan_uncompressed_filename, "rb", &:read) end # (expected_content should be uncompressed) @@ -97,9 +87,7 @@ module ChefHTTPShared "Content-Encoding" => "gzip", } ) do - File.open(nyan_compressed_filename, "rb") do |f| - f.read - end + File.open(nyan_compressed_filename, "rb", &:read) end # @@ -112,9 +100,7 @@ module ChefHTTPShared "Content-Length" => (nyan_uncompressed_size + 1).to_s, } ) do - File.open(nyan_uncompressed_filename, "rb") do |f| - f.read - end + File.open(nyan_uncompressed_filename, "rb", &:read) end # (expected_content should be uncompressed) @@ -125,9 +111,7 @@ module ChefHTTPShared "Content-Encoding" => "gzip", } ) do - File.open(nyan_compressed_filename, "rb") do |f| - f.read - end + File.open(nyan_compressed_filename, "rb", &:read) end # @@ -141,9 +125,7 @@ module ChefHTTPShared "Transfer-Encoding" => "anything", } ) do - File.open(nyan_uncompressed_filename, "rb") do |f| - f.read - end + File.open(nyan_uncompressed_filename, "rb", &:read) end # diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb index 6705c8e2d8..010ef27f47 100644 --- a/spec/support/shared/functional/securable_resource.rb +++ b/spec/support/shared/functional/securable_resource.rb @@ -89,7 +89,7 @@ shared_context "use Windows permissions", :windows_only do end def explicit_aces - descriptor.dacl.select { |ace| ace.explicit? } + descriptor.dacl.select(&:explicit?) end def extract_ace_properties(aces) @@ -560,16 +560,12 @@ shared_examples_for "a securable resource without existing target" do # On certain flavors of Windows the default list of ACLs sometimes includes # non-inherited ACLs. Filter them out here. - parent_inherited_acls = parent_acls.dacl.collect do |ace| - ace.inherited? - end + parent_inherited_acls = parent_acls.dacl.collect(&:inherited?) resource.run_action(:create) # Similarly filter out the non-inherited ACLs - resource_inherited_acls = descriptor.dacl.collect do |ace| - ace.inherited? - end + resource_inherited_acls = descriptor.dacl.collect(&:inherited?) expect(resource_inherited_acls).to eq(parent_inherited_acls) end |