paperclip 6.0.0 → 6.1.0

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 (42) hide show
  1. checksums.yaml +5 -5
  2. data/.github/issue_template.md +3 -0
  3. data/MIGRATING-ES.md +317 -0
  4. data/MIGRATING.md +375 -0
  5. data/NEWS +17 -0
  6. data/README.md +26 -4
  7. data/UPGRADING +3 -3
  8. data/features/step_definitions/attachment_steps.rb +10 -10
  9. data/lib/paperclip.rb +1 -0
  10. data/lib/paperclip/attachment.rb +19 -6
  11. data/lib/paperclip/filename_cleaner.rb +0 -1
  12. data/lib/paperclip/geometry_detector_factory.rb +1 -1
  13. data/lib/paperclip/interpolations.rb +6 -1
  14. data/lib/paperclip/io_adapters/abstract_adapter.rb +11 -10
  15. data/lib/paperclip/io_adapters/attachment_adapter.rb +7 -1
  16. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +2 -1
  17. data/lib/paperclip/io_adapters/uri_adapter.rb +8 -6
  18. data/lib/paperclip/logger.rb +1 -1
  19. data/lib/paperclip/media_type_spoof_detector.rb +8 -5
  20. data/lib/paperclip/processor.rb +10 -2
  21. data/lib/paperclip/schema.rb +1 -1
  22. data/lib/paperclip/storage/fog.rb +1 -1
  23. data/lib/paperclip/style.rb +0 -1
  24. data/lib/paperclip/thumbnail.rb +4 -1
  25. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +4 -0
  26. data/lib/paperclip/version.rb +1 -1
  27. data/spec/paperclip/attachment_processing_spec.rb +0 -1
  28. data/spec/paperclip/attachment_spec.rb +17 -2
  29. data/spec/paperclip/filename_cleaner_spec.rb +0 -1
  30. data/spec/paperclip/integration_spec.rb +41 -5
  31. data/spec/paperclip/interpolations_spec.rb +9 -0
  32. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +28 -0
  33. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +33 -16
  34. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +56 -8
  35. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +1 -1
  36. data/spec/paperclip/media_type_spoof_detector_spec.rb +26 -0
  37. data/spec/paperclip/schema_spec.rb +46 -46
  38. data/spec/paperclip/style_spec.rb +0 -1
  39. data/spec/paperclip/thumbnail_spec.rb +5 -3
  40. data/spec/paperclip/url_generator_spec.rb +0 -1
  41. data/spec/support/model_reconstruction.rb +2 -2
  42. metadata +9 -6
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'spec_helper'
3
2
 
4
3
  describe 'Attachment Processing' do
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Paperclip::Attachment do
@@ -54,6 +53,22 @@ describe Paperclip::Attachment do
54
53
  expect(dummy.avatar.path(:original)).to exist
55
54
  end
56
55
 
56
+ it "reprocess works with virtual content_type attribute" do
57
+ rebuild_class styles: { small: "100x>" }
58
+ modify_table { |t| t.remove :avatar_content_type }
59
+ Dummy.send :attr_accessor, :avatar_content_type
60
+ Dummy.validates_attachment_content_type(
61
+ :avatar,
62
+ content_type: %w(image/jpeg image/png)
63
+ )
64
+ Dummy.create!(avatar: File.new(fixture_file("50x50.png"), "rb"))
65
+
66
+ dummy = Dummy.first
67
+ dummy.avatar.reprocess!(:small)
68
+
69
+ expect(dummy.avatar.path(:small)).to exist
70
+ end
71
+
57
72
  context "having a not empty hash as a default option" do
58
73
  before do
59
74
  @old_default_options = Paperclip::Attachment.default_options.dup
@@ -1401,7 +1416,7 @@ describe Paperclip::Attachment do
1401
1416
 
1402
1417
  context "and avatar_file_size column" do
1403
1418
  before do
1404
- ActiveRecord::Base.connection.add_column :dummies, :avatar_file_size, :integer
1419
+ ActiveRecord::Base.connection.add_column :dummies, :avatar_file_size, :bigint
1405
1420
  rebuild_class
1406
1421
  @dummy = Dummy.new
1407
1422
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require 'spec_helper'
3
2
 
4
3
  describe Paperclip::FilenameCleaner do
@@ -1,16 +1,33 @@
1
- # encoding: utf-8
2
1
  require 'spec_helper'
3
2
  require 'open-uri'
4
3
 
5
4
  describe 'Paperclip' do
5
+ around do |example|
6
+ files_before = ObjectSpace.each_object(Tempfile).select do |file|
7
+ file.path && File.file?(file.path)
8
+ end
9
+
10
+ example.run
11
+
12
+ files_after = ObjectSpace.each_object(Tempfile).select do |file|
13
+ file.path && File.file?(file.path)
14
+ end
15
+
16
+ diff = files_after - files_before
17
+ expect(diff).to eq([]), "Leaked tempfiles: #{diff.inspect}"
18
+ end
19
+
6
20
  context "Many models at once" do
7
21
  before do
8
22
  rebuild_model
9
23
  @file = File.new(fixture_file("5k.png"), 'rb')
10
24
  # Deals with `Too many open files` error
11
- Dummy.import 100.times.map { Dummy.new avatar: @file }
12
- Dummy.import 100.times.map { Dummy.new avatar: @file }
13
- Dummy.import 100.times.map { Dummy.new avatar: @file }
25
+ dummies = Array.new(300) { Dummy.new avatar: @file }
26
+ Dummy.import dummies
27
+ # save attachment instances to run after hooks including tempfile cleanup
28
+ # since activerecord-import does not use our usually hooked-in hooks
29
+ # (such as after_save)
30
+ dummies.each { |dummy| dummy.avatar.save }
14
31
  end
15
32
 
16
33
  after { @file.close }
@@ -135,6 +152,14 @@ describe 'Paperclip' do
135
152
  end
136
153
 
137
154
  it "allows us to selectively create each thumbnail" do
155
+ skip <<-EXPLANATION
156
+ #reprocess! calls #assign which calls Paperclip.io_adapters.for
157
+ which creates the tempfile. #assign then calls #post_process_file which
158
+ calls MediaTypeSpoofDetectionValidator#validate_each which calls
159
+ Paperclip.io_adapters.for, which creates another tempfile. That first
160
+ tempfile is the one that leaks.
161
+ EXPLANATION
162
+
138
163
  assert_file_not_exists(@thumb_small_path)
139
164
  assert_file_not_exists(@thumb_large_path)
140
165
 
@@ -159,7 +184,11 @@ describe 'Paperclip' do
159
184
  assert_not_equal File.size(@file.path), @dummy.avatar.size
160
185
  end
161
186
 
162
- after { @file.close }
187
+ after do
188
+ @file.close
189
+ # save attachment instance to run after hooks (including tempfile cleanup)
190
+ @dummy.avatar.save
191
+ end
163
192
  end
164
193
 
165
194
  context "A model with attachments scoped under an id" do
@@ -347,6 +376,8 @@ describe 'Paperclip' do
347
376
  it "is not ok with bad files" do
348
377
  @dummy.avatar = @bad_file
349
378
  assert ! @dummy.valid?
379
+ # save attachment instance to run after hooks (including tempfile cleanup)
380
+ @dummy.avatar.save
350
381
  end
351
382
 
352
383
  it "knows the difference between good files, bad files, and not files when validating" do
@@ -354,8 +385,13 @@ describe 'Paperclip' do
354
385
  @d2 = Dummy.find(@dummy.id)
355
386
  @d2.avatar = @file
356
387
  assert @d2.valid?, @d2.errors.full_messages.inspect
388
+ # save attachment instance to run after hooks (including tempfile cleanup)
389
+ @d2.avatar.save
390
+
357
391
  @d2.avatar = @bad_file
358
392
  assert ! @d2.valid?
393
+ # save attachment instance to run after hooks (including tempfile cleanup)
394
+ @d2.avatar.save
359
395
  end
360
396
 
361
397
  it "is able to reload without saving and not have the file disappear" do
@@ -139,6 +139,15 @@ describe Paperclip::Interpolations do
139
139
  assert_equal "000/000/023", Paperclip::Interpolations.id_partition(attachment, :style)
140
140
  end
141
141
 
142
+ it "returns the partitioned id when the id is above 999_999_999" do
143
+ attachment = mock
144
+ attachment.expects(:id).
145
+ returns(Paperclip::Interpolations::ID_PARTITION_LIMIT)
146
+ attachment.expects(:instance).returns(attachment)
147
+ assert_equal "001/000/000/000",
148
+ Paperclip::Interpolations.id_partition(attachment, :style)
149
+ end
150
+
142
151
  it "returns the partitioned id of the attachment when the id is a string" do
143
152
  attachment = mock
144
153
  attachment.expects(:id).returns("32fnj23oio2f")
@@ -93,6 +93,34 @@ describe Paperclip::AbstractAdapter do
93
93
  end
94
94
  end
95
95
 
96
+ context "#copy_to_tempfile" do
97
+ around do |example|
98
+ FileUtils.module_eval do
99
+ class << self
100
+ alias paperclip_ln ln
101
+
102
+ def ln(*)
103
+ raise Errno::EXDEV
104
+ end
105
+ end
106
+ end
107
+
108
+ example.run
109
+
110
+ FileUtils.module_eval do
111
+ class << self
112
+ alias ln paperclip_ln
113
+ undef paperclip_ln
114
+ end
115
+ end
116
+ end
117
+
118
+ it "should return a readable file even when linking fails" do
119
+ src = open(fixture_file("5k.png"), "rb")
120
+ expect(subject.send(:copy_to_tempfile, src).read).to eq src.read
121
+ end
122
+ end
123
+
96
124
  context "#original_filename=" do
97
125
  it "should not fail with a nil original filename" do
98
126
  expect { subject.original_filename = nil }.not_to raise_error
@@ -3,10 +3,9 @@ require 'spec_helper'
3
3
  describe Paperclip::HttpUrlProxyAdapter do
4
4
  before do
5
5
  @open_return = StringIO.new("xxx")
6
- @open_return.stubs(:content_type).returns("image/png")
7
- @open_return.stubs(:meta).returns({})
8
- Paperclip::HttpUrlProxyAdapter.any_instance.
9
- stubs(:download_content).returns(@open_return)
6
+ @open_return.stubs(:meta).returns("content-type" => "image/png")
7
+ Paperclip::HttpUrlProxyAdapter.any_instance.stubs(:download_content).
8
+ returns(@open_return)
10
9
  Paperclip::HttpUrlProxyAdapter.register
11
10
  end
12
11
 
@@ -69,17 +68,18 @@ describe Paperclip::HttpUrlProxyAdapter do
69
68
  end
70
69
 
71
70
  context "a url with query params" do
72
- before do
73
- @url = "https://github.com/thoughtbot/paperclip?file=test"
74
- @subject = Paperclip.io_adapters.for(@url)
75
- end
71
+ subject { Paperclip.io_adapters.for(url) }
76
72
 
77
- after do
78
- @subject.close
79
- end
73
+ after { subject.close }
74
+
75
+ let(:url) { "https://github.com/thoughtbot/paperclip?file=test" }
80
76
 
81
77
  it "returns a file name" do
82
- assert_equal "paperclip", @subject.original_filename
78
+ assert_equal "paperclip", subject.original_filename
79
+ end
80
+
81
+ it "preserves params" do
82
+ assert_equal url, subject.instance_variable_get(:@target).to_s
83
83
  end
84
84
  end
85
85
 
@@ -107,15 +107,32 @@ describe Paperclip::HttpUrlProxyAdapter do
107
107
  end
108
108
 
109
109
  context "a url with special characters in the filename" do
110
- it "returns a encoded filename" do
110
+ before do
111
111
  Paperclip::HttpUrlProxyAdapter.any_instance.stubs(:download_content).
112
112
  returns(@open_return)
113
- url = "https://github.com/thoughtbot/paperclip-öäü字´½♥زÈ.png"
114
- subject = Paperclip.io_adapters.for(url)
115
- filename = "paperclip-%C3%B6%C3%A4%C3%BC%E5%AD%97%C2%B4%C2%BD%E2%99%A5"\
113
+ end
114
+
115
+ let(:filename) do
116
+ "paperclip-%C3%B6%C3%A4%C3%BC%E5%AD%97%C2%B4%C2%BD%E2%99%A5"\
116
117
  "%C3%98%C2%B2%C3%88.png"
118
+ end
119
+ let(:url) { "https://github.com/thoughtbot/paperclip-öäü字´½♥زÈ.png" }
117
120
 
121
+ subject { Paperclip.io_adapters.for(url) }
122
+
123
+ it "returns a encoded filename" do
118
124
  assert_equal filename, subject.original_filename
119
125
  end
126
+
127
+ context "when already URI encoded" do
128
+ let(:url) do
129
+ "https://github.com/thoughtbot/paperclip-%C3%B6%C3%A4%C3%BC%E5%AD%97"\
130
+ "%C2%B4%C2%BD%E2%99%A5%C3%98%C2%B2%C3%88.png"
131
+ end
132
+
133
+ it "returns a encoded filename" do
134
+ assert_equal filename, subject.original_filename
135
+ end
136
+ end
120
137
  end
121
138
  end
@@ -16,6 +16,8 @@ describe Paperclip::UriAdapter do
16
16
  end
17
17
 
18
18
  context "a new instance" do
19
+ let(:meta) { { "content-type" => "image/png" } }
20
+
19
21
  before do
20
22
  Paperclip::UriAdapter.any_instance.
21
23
  stubs(:download_content).returns(@open_return)
@@ -62,7 +64,7 @@ describe Paperclip::UriAdapter do
62
64
  assert_equal 'image/png', @subject.content_type
63
65
  end
64
66
 
65
- it 'accepts an orgiginal_filename' do
67
+ it "accepts an original_filename" do
66
68
  @subject.original_filename = 'image.png'
67
69
  assert_equal 'image.png', @subject.original_filename
68
70
  end
@@ -71,6 +73,7 @@ describe Paperclip::UriAdapter do
71
73
 
72
74
  context "a directory index url" do
73
75
  let(:content_type) { "text/html" }
76
+ let(:meta) { { "content-type" => "text/html" } }
74
77
 
75
78
  before do
76
79
  Paperclip::UriAdapter.any_instance.
@@ -105,23 +108,68 @@ describe Paperclip::UriAdapter do
105
108
 
106
109
  context "a url with content disposition headers" do
107
110
  let(:file_name) { "test_document.pdf" }
108
- let(:meta) do
109
- {
110
- "content-disposition" => "attachment; filename=\"#{file_name}\";",
111
- }
112
- end
111
+ let(:filename_from_path) { "paperclip" }
113
112
 
114
113
  before do
115
114
  Paperclip::UriAdapter.any_instance.
116
115
  stubs(:download_content).returns(@open_return)
117
116
 
118
- @uri = URI.parse("https://github.com/thoughtbot/paperclip?file=test")
117
+ @uri = URI.parse(
118
+ "https://github.com/thoughtbot/#{filename_from_path}?file=test")
119
+ end
120
+
121
+ it "returns file name from path" do
122
+ meta["content-disposition"] = "inline;"
123
+
119
124
  @subject = Paperclip.io_adapters.for(@uri)
125
+
126
+ assert_equal filename_from_path, @subject.original_filename
120
127
  end
121
128
 
122
- it "returns a file name" do
129
+ it "returns a file name enclosed in double quotes" do
130
+ file_name = "john's test document.pdf"
131
+ meta["content-disposition"] = "attachment; filename=\"#{file_name}\";"
132
+
133
+ @subject = Paperclip.io_adapters.for(@uri)
134
+
135
+ assert_equal file_name, @subject.original_filename
136
+ end
137
+
138
+ it "returns a file name not enclosed in double quotes" do
139
+ meta["content-disposition"] = "ATTACHMENT; FILENAME=#{file_name};"
140
+
141
+ @subject = Paperclip.io_adapters.for(@uri)
142
+
143
+ assert_equal file_name, @subject.original_filename
144
+ end
145
+
146
+ it "does not crash when an empty filename is given" do
147
+ meta["content-disposition"] = "ATTACHMENT; FILENAME=\"\";"
148
+
149
+ @subject = Paperclip.io_adapters.for(@uri)
150
+
151
+ assert_equal "", @subject.original_filename
152
+ end
153
+
154
+ it "returns a file name ignoring RFC 5987 encoding" do
155
+ meta["content-disposition"] =
156
+ "attachment; filename=#{file_name}; filename* = utf-8''%e2%82%ac%20rates"
157
+
158
+ @subject = Paperclip.io_adapters.for(@uri)
159
+
123
160
  assert_equal file_name, @subject.original_filename
124
161
  end
162
+
163
+ context "when file name has consecutive periods" do
164
+ let(:file_name) { "test_document..pdf" }
165
+
166
+ it "returns a file name" do
167
+ @uri = URI.parse(
168
+ "https://github.com/thoughtbot/#{file_name}?file=test")
169
+ @subject = Paperclip.io_adapters.for(@uri)
170
+ assert_equal file_name, @subject.original_filename
171
+ end
172
+ end
125
173
  end
126
174
 
127
175
  context "a url with restricted characters in the filename" do
@@ -7,7 +7,7 @@ describe Paperclip::Shoulda::Matchers::ValidateAttachmentSizeMatcher do
7
7
  before do
8
8
  reset_table("dummies") do |d|
9
9
  d.string :avatar_file_name
10
- d.integer :avatar_file_size
10
+ d.bigint :avatar_file_size
11
11
  end
12
12
  reset_class "Dummy"
13
13
  Dummy.do_not_validate_attachment_file_type :avatar
@@ -58,6 +58,32 @@ describe Paperclip::MediaTypeSpoofDetector do
58
58
  end
59
59
  end
60
60
 
61
+ context "GIF file named without extension, but we're told GIF" do
62
+ let(:file) { File.open(fixture_file("animated")) }
63
+ let(:spoofed?) do
64
+ Paperclip::MediaTypeSpoofDetector.
65
+ using(file, "animated", "image/gif").
66
+ spoofed?
67
+ end
68
+
69
+ it "accepts the file" do
70
+ assert !spoofed?
71
+ end
72
+ end
73
+
74
+ context "GIF file named without extension, but we're told HTML" do
75
+ let(:file) { File.open(fixture_file("animated")) }
76
+ let(:spoofed?) do
77
+ Paperclip::MediaTypeSpoofDetector.
78
+ using(file, "animated", "text/html").
79
+ spoofed?
80
+ end
81
+
82
+ it "rejects the file" do
83
+ assert spoofed?
84
+ end
85
+ end
86
+
61
87
  it "does not reject if content_type is empty but otherwise checks out" do
62
88
  file = File.open(fixture_file("empty.html"))
63
89
  assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").spoofed?
@@ -25,12 +25,12 @@ describe Paperclip::Schema do
25
25
  end
26
26
  end
27
27
 
28
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
28
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
29
29
 
30
- expect(columns).to include(['avatar_file_name', :string])
31
- expect(columns).to include(['avatar_content_type', :string])
32
- expect(columns).to include(['avatar_file_size', :integer])
33
- expect(columns).to include(['avatar_updated_at', :datetime])
30
+ expect(columns).to include(['avatar_file_name', "varchar"])
31
+ expect(columns).to include(['avatar_content_type', "varchar"])
32
+ expect(columns).to include(['avatar_file_size', "bigint"])
33
+ expect(columns).to include(['avatar_updated_at', "datetime"])
34
34
  end
35
35
 
36
36
  it "displays deprecation warning" do
@@ -50,12 +50,12 @@ describe Paperclip::Schema do
50
50
  end
51
51
 
52
52
  it "creates attachment columns" do
53
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
53
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
54
54
 
55
- expect(columns).to include(['avatar_file_name', :string])
56
- expect(columns).to include(['avatar_content_type', :string])
57
- expect(columns).to include(['avatar_file_size', :integer])
58
- expect(columns).to include(['avatar_updated_at', :datetime])
55
+ expect(columns).to include(['avatar_file_name', "varchar"])
56
+ expect(columns).to include(['avatar_content_type', "varchar"])
57
+ expect(columns).to include(['avatar_file_size', "bigint"])
58
+ expect(columns).to include(['avatar_updated_at', "datetime"])
59
59
  end
60
60
  end
61
61
 
@@ -89,12 +89,12 @@ describe Paperclip::Schema do
89
89
  end
90
90
 
91
91
  it "creates attachment columns" do
92
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
92
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
93
93
 
94
- expect(columns).to include(['avatar_file_name', :string])
95
- expect(columns).to include(['avatar_content_type', :string])
96
- expect(columns).to include(['avatar_file_size', :integer])
97
- expect(columns).to include(['avatar_updated_at', :datetime])
94
+ expect(columns).to include(['avatar_file_name', "varchar"])
95
+ expect(columns).to include(['avatar_content_type', "varchar"])
96
+ expect(columns).to include(['avatar_file_size', "bigint"])
97
+ expect(columns).to include(['avatar_updated_at', "datetime"])
98
98
  end
99
99
  end
100
100
 
@@ -119,16 +119,16 @@ describe Paperclip::Schema do
119
119
  end
120
120
 
121
121
  it "creates attachment columns" do
122
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
122
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
123
123
 
124
- expect(columns).to include(['avatar_file_name', :string])
125
- expect(columns).to include(['avatar_content_type', :string])
126
- expect(columns).to include(['avatar_file_size', :integer])
127
- expect(columns).to include(['avatar_updated_at', :datetime])
128
- expect(columns).to include(['photo_file_name', :string])
129
- expect(columns).to include(['photo_content_type', :string])
130
- expect(columns).to include(['photo_file_size', :integer])
131
- expect(columns).to include(['photo_updated_at', :datetime])
124
+ expect(columns).to include(['avatar_file_name', "varchar"])
125
+ expect(columns).to include(['avatar_content_type', "varchar"])
126
+ expect(columns).to include(['avatar_file_size', "bigint"])
127
+ expect(columns).to include(['avatar_updated_at', "datetime"])
128
+ expect(columns).to include(['photo_file_name', "varchar"])
129
+ expect(columns).to include(['photo_content_type', "varchar"])
130
+ expect(columns).to include(['photo_file_size', "bigint"])
131
+ expect(columns).to include(['photo_updated_at', "datetime"])
132
132
  end
133
133
  end
134
134
 
@@ -164,7 +164,7 @@ describe Paperclip::Schema do
164
164
  Dummy.connection.change_table :dummies do |t|
165
165
  t.column :avatar_file_name, :string
166
166
  t.column :avatar_content_type, :string
167
- t.column :avatar_file_size, :integer
167
+ t.column :avatar_file_size, :bigint
168
168
  t.column :avatar_updated_at, :datetime
169
169
  end
170
170
  end
@@ -178,12 +178,12 @@ describe Paperclip::Schema do
178
178
  Dummy.connection.drop_attached_file :dummies, :avatar
179
179
  end
180
180
 
181
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
181
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
182
182
 
183
- expect(columns).to_not include(['avatar_file_name', :string])
184
- expect(columns).to_not include(['avatar_content_type', :string])
185
- expect(columns).to_not include(['avatar_file_size', :integer])
186
- expect(columns).to_not include(['avatar_updated_at', :datetime])
183
+ expect(columns).to_not include(['avatar_file_name', "varchar"])
184
+ expect(columns).to_not include(['avatar_content_type', "varchar"])
185
+ expect(columns).to_not include(['avatar_file_size', "bigint"])
186
+ expect(columns).to_not include(['avatar_updated_at', "datetime"])
187
187
  end
188
188
 
189
189
  it "displays a deprecation warning" do
@@ -200,12 +200,12 @@ describe Paperclip::Schema do
200
200
  end
201
201
 
202
202
  it "removes the attachment columns" do
203
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
203
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
204
204
 
205
- expect(columns).to_not include(['avatar_file_name', :string])
206
- expect(columns).to_not include(['avatar_content_type', :string])
207
- expect(columns).to_not include(['avatar_file_size', :integer])
208
- expect(columns).to_not include(['avatar_updated_at', :datetime])
205
+ expect(columns).to_not include(['avatar_file_name', "varchar"])
206
+ expect(columns).to_not include(['avatar_content_type', "varchar"])
207
+ expect(columns).to_not include(['avatar_file_size', "bigint"])
208
+ expect(columns).to_not include(['avatar_updated_at', "datetime"])
209
209
  end
210
210
  end
211
211
 
@@ -214,7 +214,7 @@ describe Paperclip::Schema do
214
214
  Dummy.connection.change_table :dummies do |t|
215
215
  t.column :photo_file_name, :string
216
216
  t.column :photo_content_type, :string
217
- t.column :photo_file_size, :integer
217
+ t.column :photo_file_size, :bigint
218
218
  t.column :photo_updated_at, :datetime
219
219
  end
220
220
 
@@ -222,16 +222,16 @@ describe Paperclip::Schema do
222
222
  end
223
223
 
224
224
  it "removes the attachment columns" do
225
- columns = Dummy.columns.map{ |column| [column.name, column.type] }
226
-
227
- expect(columns).to_not include(['avatar_file_name', :string])
228
- expect(columns).to_not include(['avatar_content_type', :string])
229
- expect(columns).to_not include(['avatar_file_size', :integer])
230
- expect(columns).to_not include(['avatar_updated_at', :datetime])
231
- expect(columns).to_not include(['photo_file_name', :string])
232
- expect(columns).to_not include(['photo_content_type', :string])
233
- expect(columns).to_not include(['photo_file_size', :integer])
234
- expect(columns).to_not include(['photo_updated_at', :datetime])
225
+ columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
226
+
227
+ expect(columns).to_not include(['avatar_file_name', "varchar"])
228
+ expect(columns).to_not include(['avatar_content_type', "varchar"])
229
+ expect(columns).to_not include(['avatar_file_size', "bigint"])
230
+ expect(columns).to_not include(['avatar_updated_at', "datetime"])
231
+ expect(columns).to_not include(['photo_file_name', "varchar"])
232
+ expect(columns).to_not include(['photo_content_type', "varchar"])
233
+ expect(columns).to_not include(['photo_file_size', "bigint"])
234
+ expect(columns).to_not include(['photo_updated_at', "datetime"])
235
235
  end
236
236
  end
237
237