diff --git a/spec/paperclip/io_adapters/uri_adapter_spec.rb b/spec/paperclip/io_adapters/uri_adapter_spec.rb index dd417d60d..d7f062285 100644 --- a/spec/paperclip/io_adapters/uri_adapter_spec.rb +++ b/spec/paperclip/io_adapters/uri_adapter_spec.rb @@ -224,7 +224,7 @@ it "calls open with read_timeout option" do expect(@uri_opener) - .to receive(:open).with(@uri, read_timeout: 120).at_least(1).times + .to receive(:open).with(@uri, { read_timeout: 120 }).at_least(1).times end end end diff --git a/spec/paperclip/paperclip_spec.rb b/spec/paperclip/paperclip_spec.rb index e72bdaf61..c31fc3db8 100644 --- a/spec/paperclip/paperclip_spec.rb +++ b/spec/paperclip/paperclip_spec.rb @@ -63,7 +63,7 @@ context "Calling Paperclip.run with a logger" do it "passes the defined logger if :log_command is set" do Paperclip.options[:log_command] = true - expect(Terrapin::CommandLine).to receive(:new).with("convert", "stuff", logger: Paperclip.logger).and_return(double(run: nil)) + expect(Terrapin::CommandLine).to receive(:new).with("convert", "stuff", { logger: Paperclip.logger }).and_return(double(run: nil)) Paperclip.run("convert", "stuff") end end diff --git a/spec/paperclip/storage/s3_spec.rb b/spec/paperclip/storage/s3_spec.rb index 5e497f105..f132d2121 100644 --- a/spec/paperclip/storage/s3_spec.rb +++ b/spec/paperclip/storage/s3_spec.rb @@ -395,12 +395,22 @@ def counter allow(@dummy.avatar).to receive(:s3_object).with(:thumbnail).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", - acl: :"public-read") + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + }, + ) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", - acl: :"public-read", - cache_control: "max-age=31557600") + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + cache_control: "max-age=31557600", + }, + ) @dummy.save end @@ -445,12 +455,12 @@ def counter it "uploads original" do expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", + { content_type: "image/png" }, ).and_return(true) @dummy.avatar.reprocess! expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", + { content_type: "image/png" }, ).and_return(true) @dummy.avatar.reprocess! end @@ -458,7 +468,7 @@ def counter it "doesn't upload original" do expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", + { content_type: "image/png" }, ).and_return(true) @dummy.avatar.reprocess! end @@ -500,14 +510,18 @@ def counter it "uploads original" do expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", - acl: :"public-read" + { + content_type: "image/png", + acl: :"public-read", + }, ).and_return(true) @dummy.avatar.reprocess! expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", - acl: :"public-read" + { + content_type: "image/png", + acl: :"public-read", + }, ).and_return(true) @dummy.avatar.reprocess! end @@ -515,8 +529,10 @@ def counter it "doesn't upload original" do expect(@object).to receive(:upload_file).with( anything, - content_type: "image/png", - acl: :"public-read" + { + content_type: "image/png", + acl: :"public-read", + }, ).and_return(true) @dummy.avatar.reprocess! end @@ -725,7 +741,7 @@ def counter object = double allow(@dummy.avatar).to receive(:s3_object).and_return(object) - expect(object).to receive(:presigned_url).with(:get, expires_in: 3600) + expect(object).to receive(:presigned_url).with(:get, { expires_in: 3600 }) @dummy.avatar.expiring_url end end @@ -740,8 +756,13 @@ def counter object = double allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:presigned_url). - with(:get, expires_in: 3600, - response_content_disposition: "inline") + with( + :get, + { + expires_in: 3600, + response_content_disposition: "inline", + }, + ) @dummy.avatar.expiring_url end end @@ -763,7 +784,13 @@ def counter object = double allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:presigned_url). - with(:get, expires_in: 3600, response_content_type: "image/png") + with( + :get, + { + expires_in: 3600, + response_content_type: "image/png", + }, + ) @dummy.avatar.expiring_url end end @@ -810,14 +837,14 @@ def counter it "generates a url for the thumb" do object = double allow(@dummy.avatar).to receive(:s3_object).with(:thumb).and_return(object) - expect(object).to receive(:presigned_url).with(:get, expires_in: 1800) + expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 }) @dummy.avatar.expiring_url(1800, :thumb) end it "generates a url for the default style" do object = double allow(@dummy.avatar).to receive(:s3_object).with(:original).and_return(object) - expect(object).to receive(:presigned_url).with(:get, expires_in: 1800) + expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 }) @dummy.avatar.expiring_url(1800) end end @@ -962,7 +989,7 @@ def counter object = double allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", acl: :"public-read") + with(anything, { content_type: "image/png", acl: :"public-read" }) @dummy.save end @@ -1122,10 +1149,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, - content_type: "image/png", - acl: :"public-read", - cache_control: "max-age=31557600") + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + cache_control: "max-age=31557600", + }, + ) @dummy.save end @@ -1163,10 +1194,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, + with( + anything, + { content_type: "image/png", acl: :"public-read", - metadata: { "color" => "red" }) + metadata: { "color" => "red" }, + }, + ) @dummy.save end @@ -1204,10 +1239,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, + with( + anything, + { content_type: "image/png", acl: :"public-read", - metadata: { "color" => "red" }) + metadata: { "color" => "red" }, + }, + ) @dummy.save end @@ -1246,10 +1285,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, + with( + anything, + { content_type: "image/png", acl: :"public-read", - storage_class: "reduced_redundancy") + storage_class: "reduced_redundancy", + }, + ) @dummy.save end @@ -1342,9 +1385,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", - acl: :"public-read", - storage_class: :reduced_redundancy) + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + storage_class: :reduced_redundancy, + }, + ) end @dummy.save end @@ -1387,7 +1435,7 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", acl: :"public-read") + with(anything, { content_type: "image/png", acl: :"public-read" }) @dummy.save end @@ -1426,9 +1474,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", - acl: :"public-read", - server_side_encryption: "AES256") + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + server_side_encryption: "AES256", + }, + ) @dummy.save end @@ -1466,10 +1519,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, - content_type: "image/png", - acl: :"public-read", - storage_class: :reduced_redundancy) + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + storage_class: :reduced_redundancy, + }, + ) @dummy.save end @@ -1613,7 +1670,7 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", acl: :"public-read") + with(anything, { content_type: "image/png", acl: :"public-read" }) @dummy.save end @@ -1651,7 +1708,7 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).and_return(object) expect(object).to receive(:upload_file). - with(anything, content_type: "image/png", acl: :private) + with(anything, { content_type: "image/png", acl: :private }) @dummy.save end @@ -1697,8 +1754,10 @@ class DummyCredentialProvider; end expect(object).to receive(:upload_file). with(anything, - content_type: "image/png", - acl: style == :thumb ? :public_read : :private) + { + content_type: "image/png", + acl: style == :thumb ? :public_read : :private + }) end @dummy.save end @@ -1767,10 +1826,14 @@ class DummyCredentialProvider; end allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object) expect(object).to receive(:upload_file). - with(anything, - content_type: "image/png", - acl: :"public-read", - content_disposition: 'attachment; filename="Custom Avatar Name.png"') + with( + anything, + { + content_type: "image/png", + acl: :"public-read", + content_disposition: 'attachment; filename="Custom Avatar Name.png"', + }, + ) end @dummy.save end