spec/paperclip/storage/s3_live_spec.rb in kt-paperclip-4.4.0 vs spec/paperclip/storage/s3_live_spec.rb in kt-paperclip-5.4.0
- old
+ new
@@ -6,13 +6,14 @@
before do
rebuild_model styles: { thumb: "100x100", square: "32x32#" },
storage: :s3,
bucket: ENV["S3_BUCKET"],
path: ":class/:attachment/:id/:style.:extension",
+ s3_region: ENV["S3_REGION"],
s3_credentials: {
- aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
- aws_secre_access_key: ENV['AWS_SECRET_ACCESS_KEY']
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
}
@file = File.new(fixture_file("5k.png"))
end
@@ -43,13 +44,14 @@
before do
rebuild_model styles: { thumb: "100x100", square: "32x32#" },
storage: :s3,
bucket: ENV["S3_BUCKET"],
path: ":class/:attachment/:id/:style.:extension",
+ s3_region: ENV["S3_REGION"],
s3_credentials: {
- aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
- aws_secre_access_key: ENV['AWS_SECRET_ACCESS_KEY']
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
}
@dummy = Dummy.new
end
@@ -62,13 +64,14 @@
before do
rebuild_model styles: { thumb: "100x100", square: "32x32#" },
storage: :s3,
bucket: ENV["S3_BUCKET"],
path: ":class/:attachment/:id/:style.:extension",
+ s3_region: ENV["S3_REGION"],
s3_credentials: {
- aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
- aws_secre_access_key: ENV['AWS_SECRET_ACCESS_KEY']
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
}
Dummy.delete_all
@dummy = Dummy.new
end
@@ -103,13 +106,16 @@
context "An attachment that uses S3 for storage and has spaces in file name" do
before do
rebuild_model styles: { thumb: "100x100", square: "32x32#" },
storage: :s3,
bucket: ENV["S3_BUCKET"],
+ s3_region: ENV["S3_REGION"],
+ url: ":s3_domain_url",
+ path: "/:class/:attachment/:id_partition/:style/:filename",
s3_credentials: {
- aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
- aws_secre_access_key: ENV['AWS_SECRET_ACCESS_KEY']
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
}
Dummy.delete_all
@file = File.new(fixture_file('spaced file.png'), 'rb')
@dummy = Dummy.new
@@ -134,26 +140,26 @@
end
it "is destroyable" do
url = @dummy.avatar.url
@dummy.destroy
- assert_not_found_response url
+ assert_forbidden_response url
end
end
context "An attachment that uses S3 for storage and uses AES256 encryption" do
before do
rebuild_model styles: { thumb: "100x100", square: "32x32#" },
storage: :s3,
bucket: ENV["S3_BUCKET"],
path: ":class/:attachment/:id/:style.:extension",
+ s3_region: ENV["S3_REGION"],
s3_credentials: {
- aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
- aws_secre_access_key: ENV['AWS_SECRET_ACCESS_KEY']
+ access_key_id: ENV['AWS_ACCESS_KEY_ID'],
+ secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
},
- s3_server_side_encryption: :aes256
-
+ s3_server_side_encryption: "AES256"
Dummy.delete_all
@dummy = Dummy.new
end
context "when assigned" do
@@ -171,10 +177,10 @@
before do
@dummy.save
end
it "is encrypted on S3" do
- assert @dummy.avatar.s3_object.server_side_encryption == :aes256
+ assert @dummy.avatar.s3_object.server_side_encryption == "AES256"
end
end
end
end
end