kt-paperclip 7.0.0 → 7.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +3 -1057
  3. data/.rubocop.yml +1059 -1
  4. data/CONTRIBUTING.md +4 -5
  5. data/Gemfile +2 -1
  6. data/NEWS +11 -0
  7. data/README.md +3 -3
  8. data/gemfiles/7.0.gemfile +21 -0
  9. data/lib/paperclip/attachment.rb +1 -1
  10. data/lib/paperclip/content_type_detector.rb +8 -3
  11. data/lib/paperclip/geometry_detector_factory.rb +1 -1
  12. data/lib/paperclip/glue.rb +3 -2
  13. data/lib/paperclip/interpolations.rb +6 -2
  14. data/lib/paperclip/locales/gd.yml +20 -0
  15. data/lib/paperclip/media_type_spoof_detector.rb +4 -1
  16. data/lib/paperclip/schema.rb +2 -2
  17. data/lib/paperclip/storage/filesystem.rb +1 -1
  18. data/lib/paperclip/storage/fog.rb +1 -1
  19. data/lib/paperclip/storage/s3.rb +18 -4
  20. data/lib/paperclip/validators/attachment_file_name_validator.rb +1 -1
  21. data/lib/paperclip/validators/attachment_size_validator.rb +2 -1
  22. data/lib/paperclip/version.rb +1 -1
  23. data/paperclip.gemspec +1 -1
  24. data/spec/paperclip/attachment_spec.rb +6 -6
  25. data/spec/paperclip/content_type_detector_spec.rb +7 -0
  26. data/spec/paperclip/geometry_detector_spec.rb +9 -0
  27. data/spec/paperclip/geometry_spec.rb +16 -4
  28. data/spec/paperclip/glue_spec.rb +21 -0
  29. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +1 -1
  30. data/spec/paperclip/media_type_spoof_detector_spec.rb +10 -4
  31. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +1 -1
  32. data/spec/paperclip/paperclip_spec.rb +1 -1
  33. data/spec/paperclip/schema_spec.rb +18 -18
  34. data/spec/paperclip/storage/filesystem_spec.rb +23 -0
  35. data/spec/paperclip/storage/fog_spec.rb +46 -0
  36. data/spec/paperclip/storage/s3_spec.rb +179 -47
  37. data/spec/paperclip/validators_spec.rb +21 -6
  38. data/spec/spec_helper.rb +1 -0
  39. data/spec/support/fixtures/sample.xlsm +0 -0
  40. data/spec/support/model_reconstruction.rb +3 -3
  41. metadata +123 -8
@@ -11,7 +11,7 @@ describe Paperclip::Schema do
11
11
 
12
12
  after do
13
13
  begin
14
- Dummy.connection.drop_table :dummies
14
+ ActiveRecord::Migration.drop_table :dummies
15
15
  rescue StandardError
16
16
  nil
17
17
  end
@@ -23,7 +23,7 @@ describe Paperclip::Schema do
23
23
  ActiveSupport::Deprecation.silenced = false
24
24
  end
25
25
  it "creates attachment columns" do
26
- Dummy.connection.create_table :dummies, force: true do |t|
26
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
27
27
  ActiveSupport::Deprecation.silence do
28
28
  t.has_attached_file :avatar
29
29
  end
@@ -38,7 +38,7 @@ describe Paperclip::Schema do
38
38
  end
39
39
 
40
40
  it "displays deprecation warning" do
41
- Dummy.connection.create_table :dummies, force: true do |t|
41
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
42
42
  assert_deprecated do
43
43
  t.has_attached_file :avatar
44
44
  end
@@ -48,7 +48,7 @@ describe Paperclip::Schema do
48
48
 
49
49
  context "using #attachment" do
50
50
  before do
51
- Dummy.connection.create_table :dummies, force: true do |t|
51
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
52
52
  t.attachment :avatar
53
53
  end
54
54
  end
@@ -65,7 +65,7 @@ describe Paperclip::Schema do
65
65
 
66
66
  context "using #attachment with options" do
67
67
  before do
68
- Dummy.connection.create_table :dummies, force: true do |t|
68
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
69
69
  t.attachment :avatar, default: 1, file_name: { default: "default" }
70
70
  end
71
71
  end
@@ -83,13 +83,13 @@ describe Paperclip::Schema do
83
83
 
84
84
  context "within schema statement" do
85
85
  before do
86
- Dummy.connection.create_table :dummies, force: true
86
+ ActiveRecord::Migration.create_table :dummies, force: true
87
87
  end
88
88
 
89
89
  context "migrating up" do
90
90
  context "with single attachment" do
91
91
  before do
92
- Dummy.connection.add_attachment :dummies, :avatar
92
+ ActiveRecord::Migration.add_attachment :dummies, :avatar
93
93
  end
94
94
 
95
95
  it "creates attachment columns" do
@@ -104,7 +104,7 @@ describe Paperclip::Schema do
104
104
 
105
105
  context "with single attachment and options" do
106
106
  before do
107
- Dummy.connection.add_attachment :dummies, :avatar, default: "1", file_name: { default: "default" }
107
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, default: "1", file_name: { default: "default" }
108
108
  end
109
109
 
110
110
  it "sets defaults on columns" do
@@ -119,7 +119,7 @@ describe Paperclip::Schema do
119
119
 
120
120
  context "with multiple attachments" do
121
121
  before do
122
- Dummy.connection.add_attachment :dummies, :avatar, :photo
122
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, :photo
123
123
  end
124
124
 
125
125
  it "creates attachment columns" do
@@ -138,7 +138,7 @@ describe Paperclip::Schema do
138
138
 
139
139
  context "with multiple attachments and options" do
140
140
  before do
141
- Dummy.connection.add_attachment :dummies, :avatar, :photo, default: "1", file_name: { default: "default" }
141
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, :photo, default: "1", file_name: { default: "default" }
142
142
  end
143
143
 
144
144
  it "sets defaults on columns" do
@@ -157,7 +157,7 @@ describe Paperclip::Schema do
157
157
  context "with no attachment" do
158
158
  it "raises an error" do
159
159
  assert_raises ArgumentError do
160
- Dummy.connection.add_attachment :dummies
160
+ ActiveRecord::Migration.add_attachment :dummies
161
161
  end
162
162
  end
163
163
  end
@@ -165,7 +165,7 @@ describe Paperclip::Schema do
165
165
 
166
166
  context "migrating down" do
167
167
  before do
168
- Dummy.connection.change_table :dummies do |t|
168
+ ActiveRecord::Migration.change_table :dummies do |t|
169
169
  t.column :avatar_file_name, :string
170
170
  t.column :avatar_content_type, :string
171
171
  t.column :avatar_file_size, :bigint
@@ -179,7 +179,7 @@ describe Paperclip::Schema do
179
179
  end
180
180
  it "removes the attachment columns" do
181
181
  ActiveSupport::Deprecation.silence do
182
- Dummy.connection.drop_attached_file :dummies, :avatar
182
+ ActiveRecord::Migration.drop_attached_file :dummies, :avatar
183
183
  end
184
184
 
185
185
  columns = Dummy.columns.map { |column| [column.name, column.sql_type] }
@@ -192,7 +192,7 @@ describe Paperclip::Schema do
192
192
 
193
193
  it "displays a deprecation warning" do
194
194
  assert_deprecated do
195
- Dummy.connection.drop_attached_file :dummies, :avatar
195
+ ActiveRecord::Migration.drop_attached_file :dummies, :avatar
196
196
  end
197
197
  end
198
198
  end
@@ -200,7 +200,7 @@ describe Paperclip::Schema do
200
200
  context "using #remove_attachment" do
201
201
  context "with single attachment" do
202
202
  before do
203
- Dummy.connection.remove_attachment :dummies, :avatar
203
+ ActiveRecord::Migration.remove_attachment :dummies, :avatar
204
204
  end
205
205
 
206
206
  it "removes the attachment columns" do
@@ -215,14 +215,14 @@ describe Paperclip::Schema do
215
215
 
216
216
  context "with multiple attachments" do
217
217
  before do
218
- Dummy.connection.change_table :dummies do |t|
218
+ ActiveRecord::Migration.change_table :dummies do |t|
219
219
  t.column :photo_file_name, :string
220
220
  t.column :photo_content_type, :string
221
221
  t.column :photo_file_size, :bigint
222
222
  t.column :photo_updated_at, :datetime
223
223
  end
224
224
 
225
- Dummy.connection.remove_attachment :dummies, :avatar, :photo
225
+ ActiveRecord::Migration.remove_attachment :dummies, :avatar, :photo
226
226
  end
227
227
 
228
228
  it "removes the attachment columns" do
@@ -242,7 +242,7 @@ describe Paperclip::Schema do
242
242
  context "with no attachment" do
243
243
  it "raises an error" do
244
244
  assert_raises ArgumentError do
245
- Dummy.connection.remove_attachment :dummies
245
+ ActiveRecord::Migration.remove_attachment :dummies
246
246
  end
247
247
  end
248
248
  end
@@ -49,6 +49,29 @@ describe Paperclip::Storage::Filesystem do
49
49
  assert_equal @file.read, tempfile.read
50
50
  tempfile.close
51
51
  end
52
+
53
+ it "only issues a delete call once for each unique attachment style when nullifying attachment" do
54
+ @dummy.save
55
+ @dummy.avatar.clear(:thumbnail)
56
+ @dummy.avatar = nil
57
+ assert_equal 3, @dummy.avatar.queued_for_delete.size
58
+
59
+ expect(FileUtils).to receive(:rm).twice
60
+ @dummy.save
61
+
62
+ FileUtils.rm_rf("tmp")
63
+ end
64
+
65
+ it "only issues a delete call once for each unique attachment style when destroying model" do
66
+ @dummy.save
67
+ @dummy.avatar.clear(:thumbnail)
68
+ assert_equal 1, @dummy.avatar.queued_for_delete.size
69
+
70
+ expect(FileUtils).to receive(:rm).twice
71
+ @dummy.destroy
72
+
73
+ FileUtils.rm_rf("tmp")
74
+ end
52
75
  end
53
76
 
54
77
  context "with file that has space in file name" do
@@ -7,6 +7,52 @@ describe Paperclip::Storage::Fog do
7
7
  context "" do
8
8
  before { Fog.mock! }
9
9
 
10
+ context "deleting attachment styles" do
11
+ before do
12
+ rebuild_model styles: { medium: "300x300>", thumb: "100x100>" },
13
+ storage: :fog,
14
+ url: "/:attachment/:style/:filename",
15
+ fog_directory: "paperclip",
16
+ fog_credentials: fixture_file("fog.yml")
17
+ @file = File.open(fixture_file("5k.png"))
18
+ @dummy = Dummy.new
19
+ @dummy.avatar = @file
20
+ @dummy.save
21
+ end
22
+
23
+ after do
24
+ @file.close
25
+ FileUtils.rm_rf("tmp")
26
+ end
27
+
28
+ it "only issues a delete call once for each unique attachment style when nullifying attachment" do
29
+ @dummy.avatar.clear(:thumb)
30
+ @dummy.avatar = nil
31
+ assert_equal 4, @dummy.avatar.queued_for_delete.size
32
+
33
+ original = double("original")
34
+ medium = double("medium")
35
+ thumb = double("thumb")
36
+
37
+ allow(Fog::AWS::Storage::File).to receive(:new).and_return(original, medium, thumb)
38
+
39
+ expect(original).to receive(:destroy).once
40
+ expect(medium).to receive(:destroy).once
41
+ expect(thumb).to receive(:destroy).once
42
+ @dummy.save
43
+ end
44
+
45
+ it "only issues a delete call once for each unique attachment style when destroying model" do
46
+ @dummy.avatar.clear(:thumb)
47
+ assert_equal 1, @dummy.avatar.queued_for_delete.size
48
+
49
+ file = double("file")
50
+ allow(Fog::AWS::Storage::File).to receive(:new).and_return(file)
51
+ expect(file).to receive(:destroy).exactly(3).times
52
+ @dummy.destroy
53
+ end
54
+ end
55
+
10
56
  context "with credentials provided in a path string" do
11
57
  before do
12
58
  rebuild_model styles: { medium: "300x300>", thumb: "100x100>" },
@@ -395,12 +395,22 @@ describe Paperclip::Storage::S3 do
395
395
  allow(@dummy.avatar).to receive(:s3_object).with(:thumbnail).and_return(object)
396
396
 
397
397
  expect(object).to receive(:upload_file).
398
- with(anything, content_type: "image/png",
399
- acl: :"public-read")
398
+ with(
399
+ anything,
400
+ {
401
+ content_type: "image/png",
402
+ acl: :"public-read",
403
+ },
404
+ )
400
405
  expect(object).to receive(:upload_file).
401
- with(anything, content_type: "image/png",
402
- acl: :"public-read",
403
- cache_control: "max-age=31557600")
406
+ with(
407
+ anything,
408
+ {
409
+ content_type: "image/png",
410
+ acl: :"public-read",
411
+ cache_control: "max-age=31557600",
412
+ },
413
+ )
404
414
  @dummy.save
405
415
  end
406
416
 
@@ -411,6 +421,62 @@ describe Paperclip::Storage::S3 do
411
421
  end
412
422
  end
413
423
 
424
+ context "An attachment that uses S3 for storage with acl disabled" do
425
+ before do
426
+ rebuild_model(
427
+ aws2_add_region.merge(
428
+ storage: :s3,
429
+ styles: { thumb: ["90x90#", :jpg] },
430
+ bucket: "bucket",
431
+ s3_acl_enabled: false,
432
+ s3_credentials: {
433
+ "access_key_id" => "12345",
434
+ "secret_access_key" => "54321"
435
+ }
436
+ )
437
+ )
438
+
439
+ @file = File.new(fixture_file("5k.png"), "rb")
440
+ @dummy = Dummy.new
441
+ @dummy.avatar = @file
442
+ @dummy.save
443
+ end
444
+
445
+ context "reprocess" do
446
+ before do
447
+ @object = double
448
+ allow(@dummy.avatar).to receive(:s3_object).with(:original).and_return(@object)
449
+ allow(@dummy.avatar).to receive(:s3_object).with(:thumb).and_return(@object)
450
+ allow(@object).to receive(:get).and_yield(@file.read)
451
+ allow(@object).to receive(:exists?).and_return(true)
452
+ allow(@object).to receive(:download_file).with(anything)
453
+ end
454
+
455
+ it "uploads original" do
456
+ expect(@object).to receive(:upload_file).with(
457
+ anything,
458
+ { content_type: "image/png" },
459
+ ).and_return(true)
460
+ @dummy.avatar.reprocess!
461
+ expect(@object).to receive(:upload_file).with(
462
+ anything,
463
+ { content_type: "image/png" },
464
+ ).and_return(true)
465
+ @dummy.avatar.reprocess!
466
+ end
467
+
468
+ it "doesn't upload original" do
469
+ expect(@object).to receive(:upload_file).with(
470
+ anything,
471
+ { content_type: "image/png" },
472
+ ).and_return(true)
473
+ @dummy.avatar.reprocess!
474
+ end
475
+ end
476
+
477
+ after { @file.close }
478
+ end
479
+
414
480
  context "An attachment that uses S3 for storage and has styles" do
415
481
  before do
416
482
  rebuild_model(
@@ -444,14 +510,18 @@ describe Paperclip::Storage::S3 do
444
510
  it "uploads original" do
445
511
  expect(@object).to receive(:upload_file).with(
446
512
  anything,
447
- content_type: "image/png",
448
- acl: :"public-read"
513
+ {
514
+ content_type: "image/png",
515
+ acl: :"public-read",
516
+ },
449
517
  ).and_return(true)
450
518
  @dummy.avatar.reprocess!
451
519
  expect(@object).to receive(:upload_file).with(
452
520
  anything,
453
- content_type: "image/png",
454
- acl: :"public-read"
521
+ {
522
+ content_type: "image/png",
523
+ acl: :"public-read",
524
+ },
455
525
  ).and_return(true)
456
526
  @dummy.avatar.reprocess!
457
527
  end
@@ -459,8 +529,10 @@ describe Paperclip::Storage::S3 do
459
529
  it "doesn't upload original" do
460
530
  expect(@object).to receive(:upload_file).with(
461
531
  anything,
462
- content_type: "image/png",
463
- acl: :"public-read"
532
+ {
533
+ content_type: "image/png",
534
+ acl: :"public-read",
535
+ },
464
536
  ).and_return(true)
465
537
  @dummy.avatar.reprocess!
466
538
  end
@@ -669,7 +741,7 @@ describe Paperclip::Storage::S3 do
669
741
  object = double
670
742
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
671
743
 
672
- expect(object).to receive(:presigned_url).with(:get, expires_in: 3600)
744
+ expect(object).to receive(:presigned_url).with(:get, { expires_in: 3600 })
673
745
  @dummy.avatar.expiring_url
674
746
  end
675
747
  end
@@ -684,8 +756,13 @@ describe Paperclip::Storage::S3 do
684
756
  object = double
685
757
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
686
758
  expect(object).to receive(:presigned_url).
687
- with(:get, expires_in: 3600,
688
- response_content_disposition: "inline")
759
+ with(
760
+ :get,
761
+ {
762
+ expires_in: 3600,
763
+ response_content_disposition: "inline",
764
+ },
765
+ )
689
766
  @dummy.avatar.expiring_url
690
767
  end
691
768
  end
@@ -707,7 +784,13 @@ describe Paperclip::Storage::S3 do
707
784
  object = double
708
785
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
709
786
  expect(object).to receive(:presigned_url).
710
- with(:get, expires_in: 3600, response_content_type: "image/png")
787
+ with(
788
+ :get,
789
+ {
790
+ expires_in: 3600,
791
+ response_content_type: "image/png",
792
+ },
793
+ )
711
794
  @dummy.avatar.expiring_url
712
795
  end
713
796
  end
@@ -754,14 +837,14 @@ describe Paperclip::Storage::S3 do
754
837
  it "generates a url for the thumb" do
755
838
  object = double
756
839
  allow(@dummy.avatar).to receive(:s3_object).with(:thumb).and_return(object)
757
- expect(object).to receive(:presigned_url).with(:get, expires_in: 1800)
840
+ expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 })
758
841
  @dummy.avatar.expiring_url(1800, :thumb)
759
842
  end
760
843
 
761
844
  it "generates a url for the default style" do
762
845
  object = double
763
846
  allow(@dummy.avatar).to receive(:s3_object).with(:original).and_return(object)
764
- expect(object).to receive(:presigned_url).with(:get, expires_in: 1800)
847
+ expect(object).to receive(:presigned_url).with(:get, { expires_in: 1800 })
765
848
  @dummy.avatar.expiring_url(1800)
766
849
  end
767
850
  end
@@ -906,7 +989,7 @@ describe Paperclip::Storage::S3 do
906
989
  object = double
907
990
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
908
991
  expect(object).to receive(:upload_file).
909
- with(anything, content_type: "image/png", acl: :"public-read")
992
+ with(anything, { content_type: "image/png", acl: :"public-read" })
910
993
  @dummy.save
911
994
  end
912
995
 
@@ -940,6 +1023,19 @@ describe Paperclip::Storage::S3 do
940
1023
  end
941
1024
  end
942
1025
 
1026
+ context "and remove, calling S3 Object destroy once per unique style" do
1027
+ before do
1028
+ allow_any_instance_of(Aws::S3::Object).to receive(:exists?).and_return(true)
1029
+ expect_any_instance_of(Aws::S3::Object).to receive(:delete).once
1030
+ @dummy.avatar.clear(:original)
1031
+ @dummy.destroy
1032
+ end
1033
+
1034
+ it "succeeds" do
1035
+ assert true
1036
+ end
1037
+ end
1038
+
943
1039
  context "that the file were missing" do
944
1040
  before do
945
1041
  allow_any_instance_of(Aws::S3::Object).to receive(:exists?).
@@ -1053,10 +1149,14 @@ describe Paperclip::Storage::S3 do
1053
1149
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1054
1150
 
1055
1151
  expect(object).to receive(:upload_file).
1056
- with(anything,
1057
- content_type: "image/png",
1058
- acl: :"public-read",
1059
- cache_control: "max-age=31557600")
1152
+ with(
1153
+ anything,
1154
+ {
1155
+ content_type: "image/png",
1156
+ acl: :"public-read",
1157
+ cache_control: "max-age=31557600",
1158
+ },
1159
+ )
1060
1160
  @dummy.save
1061
1161
  end
1062
1162
 
@@ -1094,10 +1194,14 @@ describe Paperclip::Storage::S3 do
1094
1194
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1095
1195
 
1096
1196
  expect(object).to receive(:upload_file).
1097
- with(anything,
1197
+ with(
1198
+ anything,
1199
+ {
1098
1200
  content_type: "image/png",
1099
1201
  acl: :"public-read",
1100
- metadata: { "color" => "red" })
1202
+ metadata: { "color" => "red" },
1203
+ },
1204
+ )
1101
1205
  @dummy.save
1102
1206
  end
1103
1207
 
@@ -1135,10 +1239,14 @@ describe Paperclip::Storage::S3 do
1135
1239
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1136
1240
 
1137
1241
  expect(object).to receive(:upload_file).
1138
- with(anything,
1242
+ with(
1243
+ anything,
1244
+ {
1139
1245
  content_type: "image/png",
1140
1246
  acl: :"public-read",
1141
- metadata: { "color" => "red" })
1247
+ metadata: { "color" => "red" },
1248
+ },
1249
+ )
1142
1250
  @dummy.save
1143
1251
  end
1144
1252
 
@@ -1177,10 +1285,14 @@ describe Paperclip::Storage::S3 do
1177
1285
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1178
1286
 
1179
1287
  expect(object).to receive(:upload_file).
1180
- with(anything,
1288
+ with(
1289
+ anything,
1290
+ {
1181
1291
  content_type: "image/png",
1182
1292
  acl: :"public-read",
1183
- storage_class: "reduced_redundancy")
1293
+ storage_class: "reduced_redundancy",
1294
+ },
1295
+ )
1184
1296
  @dummy.save
1185
1297
  end
1186
1298
 
@@ -1273,9 +1385,14 @@ describe Paperclip::Storage::S3 do
1273
1385
  allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object)
1274
1386
 
1275
1387
  expect(object).to receive(:upload_file).
1276
- with(anything, content_type: "image/png",
1277
- acl: :"public-read",
1278
- storage_class: :reduced_redundancy)
1388
+ with(
1389
+ anything,
1390
+ {
1391
+ content_type: "image/png",
1392
+ acl: :"public-read",
1393
+ storage_class: :reduced_redundancy,
1394
+ },
1395
+ )
1279
1396
  end
1280
1397
  @dummy.save
1281
1398
  end
@@ -1318,7 +1435,7 @@ describe Paperclip::Storage::S3 do
1318
1435
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1319
1436
 
1320
1437
  expect(object).to receive(:upload_file).
1321
- with(anything, content_type: "image/png", acl: :"public-read")
1438
+ with(anything, { content_type: "image/png", acl: :"public-read" })
1322
1439
  @dummy.save
1323
1440
  end
1324
1441
 
@@ -1357,9 +1474,14 @@ describe Paperclip::Storage::S3 do
1357
1474
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1358
1475
 
1359
1476
  expect(object).to receive(:upload_file).
1360
- with(anything, content_type: "image/png",
1361
- acl: :"public-read",
1362
- server_side_encryption: "AES256")
1477
+ with(
1478
+ anything,
1479
+ {
1480
+ content_type: "image/png",
1481
+ acl: :"public-read",
1482
+ server_side_encryption: "AES256",
1483
+ },
1484
+ )
1363
1485
  @dummy.save
1364
1486
  end
1365
1487
 
@@ -1397,10 +1519,14 @@ describe Paperclip::Storage::S3 do
1397
1519
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1398
1520
 
1399
1521
  expect(object).to receive(:upload_file).
1400
- with(anything,
1401
- content_type: "image/png",
1402
- acl: :"public-read",
1403
- storage_class: :reduced_redundancy)
1522
+ with(
1523
+ anything,
1524
+ {
1525
+ content_type: "image/png",
1526
+ acl: :"public-read",
1527
+ storage_class: :reduced_redundancy,
1528
+ },
1529
+ )
1404
1530
  @dummy.save
1405
1531
  end
1406
1532
 
@@ -1544,7 +1670,7 @@ describe Paperclip::Storage::S3 do
1544
1670
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1545
1671
 
1546
1672
  expect(object).to receive(:upload_file).
1547
- with(anything, content_type: "image/png", acl: :"public-read")
1673
+ with(anything, { content_type: "image/png", acl: :"public-read" })
1548
1674
  @dummy.save
1549
1675
  end
1550
1676
 
@@ -1582,7 +1708,7 @@ describe Paperclip::Storage::S3 do
1582
1708
  allow(@dummy.avatar).to receive(:s3_object).and_return(object)
1583
1709
 
1584
1710
  expect(object).to receive(:upload_file).
1585
- with(anything, content_type: "image/png", acl: :private)
1711
+ with(anything, { content_type: "image/png", acl: :private })
1586
1712
  @dummy.save
1587
1713
  end
1588
1714
 
@@ -1628,8 +1754,10 @@ describe Paperclip::Storage::S3 do
1628
1754
 
1629
1755
  expect(object).to receive(:upload_file).
1630
1756
  with(anything,
1631
- content_type: "image/png",
1632
- acl: style == :thumb ? :public_read : :private)
1757
+ {
1758
+ content_type: "image/png",
1759
+ acl: style == :thumb ? :public_read : :private
1760
+ })
1633
1761
  end
1634
1762
  @dummy.save
1635
1763
  end
@@ -1698,10 +1826,14 @@ describe Paperclip::Storage::S3 do
1698
1826
  allow(@dummy.avatar).to receive(:s3_object).with(style).and_return(object)
1699
1827
 
1700
1828
  expect(object).to receive(:upload_file).
1701
- with(anything,
1702
- content_type: "image/png",
1703
- acl: :"public-read",
1704
- content_disposition: 'attachment; filename="Custom Avatar Name.png"')
1829
+ with(
1830
+ anything,
1831
+ {
1832
+ content_type: "image/png",
1833
+ acl: :"public-read",
1834
+ content_disposition: 'attachment; filename="Custom Avatar Name.png"',
1835
+ },
1836
+ )
1705
1837
  end
1706
1838
  @dummy.save
1707
1839
  end