spec/paperclip/storage/s3_spec.rb in kt-paperclip-7.2.0 vs spec/paperclip/storage/s3_spec.rb in kt-paperclip-7.2.1
- old
+ new
@@ -393,16 +393,26 @@
object = double
allow(@dummy.avatar).to receive(:s3_object).with(:original).and_return(object)
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
after { @file.close }
@@ -443,24 +453,24 @@
end
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
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
end
@@ -498,27 +508,33 @@
end
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
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
end
@@ -723,11 +739,11 @@
@dummy.avatar = stringy_file
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
it "allows overriding s3_url_options" do
@@ -738,12 +754,17 @@
@dummy.avatar = stringy_file
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
it "allows overriding s3_object options with a proc" do
@@ -761,11 +782,17 @@
@dummy.avatar = @file
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
end
@@ -808,18 +835,18 @@
end
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
context "Parsing S3 credentials with a bucket in them" do
@@ -960,11 +987,11 @@
context "and saved" do
before do
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
it "succeeds" do
assert true
@@ -1120,14 +1147,18 @@
before do
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",
- cache_control: "max-age=31557600")
+ with(
+ anything,
+ {
+ content_type: "image/png",
+ acl: :"public-read",
+ cache_control: "max-age=31557600",
+ },
+ )
@dummy.save
end
it "succeeds" do
assert true
@@ -1161,14 +1192,18 @@
before do
object = double
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
it "succeeds" do
assert true
@@ -1202,14 +1237,18 @@
before do
object = double
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
it "succeeds" do
assert true
@@ -1244,14 +1283,18 @@
before do
object = double
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
it "succeeds" do
assert true
@@ -1340,13 +1383,18 @@
object = double
[:thumb, :original].each do |style|
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
it "succeeds" do
@@ -1385,11 +1433,11 @@
before do
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
it "succeeds" do
assert true
@@ -1424,13 +1472,18 @@
before do
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",
- server_side_encryption: "AES256")
+ with(
+ anything,
+ {
+ content_type: "image/png",
+ acl: :"public-read",
+ server_side_encryption: "AES256",
+ },
+ )
@dummy.save
end
it "succeeds" do
assert true
@@ -1464,14 +1517,18 @@
before do
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",
- storage_class: :reduced_redundancy)
+ with(
+ anything,
+ {
+ content_type: "image/png",
+ acl: :"public-read",
+ storage_class: :reduced_redundancy,
+ },
+ )
@dummy.save
end
it "succeeds" do
assert true
@@ -1611,11 +1668,11 @@
before do
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
it "succeeds" do
assert true
@@ -1649,11 +1706,11 @@
before do
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: :private)
+ with(anything, { content_type: "image/png", acl: :private })
@dummy.save
end
it "succeeds" do
assert true
@@ -1695,12 +1752,14 @@
object = double
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: style == :thumb ? :public_read : :private)
+ {
+ content_type: "image/png",
+ acl: style == :thumb ? :public_read : :private
+ })
end
@dummy.save
end
it "succeeds" do
@@ -1765,13 +1824,17 @@
[:thumb, :original].each do |style|
object = double
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
it "succeeds" do