dsturnbull-carrierwave 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/Generators +4 -0
  2. data/History.txt +118 -0
  3. data/Manifest.txt +107 -0
  4. data/README.rdoc +502 -0
  5. data/Rakefile +38 -0
  6. data/cucumber.yml +2 -0
  7. data/features/caching.feature +28 -0
  8. data/features/download.feature +20 -0
  9. data/features/file_storage.feature +37 -0
  10. data/features/file_storage_overridden_filename.feature +38 -0
  11. data/features/file_storage_overridden_store_dir.feature +38 -0
  12. data/features/file_storage_reversing_processor.feature +43 -0
  13. data/features/fixtures/bork.txt +1 -0
  14. data/features/fixtures/monkey.txt +1 -0
  15. data/features/grid_fs_storage.feature +32 -0
  16. data/features/mount_activerecord.feature +46 -0
  17. data/features/mount_datamapper.feature +46 -0
  18. data/features/step_definitions/activerecord_steps.rb +22 -0
  19. data/features/step_definitions/caching_steps.rb +14 -0
  20. data/features/step_definitions/datamapper_steps.rb +29 -0
  21. data/features/step_definitions/download_steps.rb +4 -0
  22. data/features/step_definitions/file_steps.rb +53 -0
  23. data/features/step_definitions/general_steps.rb +85 -0
  24. data/features/step_definitions/mount_steps.rb +19 -0
  25. data/features/step_definitions/store_steps.rb +18 -0
  26. data/features/support/activerecord.rb +30 -0
  27. data/features/support/datamapper.rb +7 -0
  28. data/features/support/env.rb +22 -0
  29. data/features/versions_basics.feature +50 -0
  30. data/features/versions_nested_versions.feature +70 -0
  31. data/features/versions_overridden_filename.feature +51 -0
  32. data/features/versions_overriden_store_dir.feature +41 -0
  33. data/lib/carrierwave/compatibility/paperclip.rb +95 -0
  34. data/lib/carrierwave/core_ext/blank.rb +46 -0
  35. data/lib/carrierwave/core_ext/inheritable_attributes.rb +104 -0
  36. data/lib/carrierwave/core_ext/module_setup.rb +51 -0
  37. data/lib/carrierwave/mount.rb +359 -0
  38. data/lib/carrierwave/orm/activerecord.rb +73 -0
  39. data/lib/carrierwave/orm/datamapper.rb +27 -0
  40. data/lib/carrierwave/orm/mongoid.rb +23 -0
  41. data/lib/carrierwave/orm/mongomapper.rb +27 -0
  42. data/lib/carrierwave/orm/sequel.rb +45 -0
  43. data/lib/carrierwave/processing/image_science.rb +101 -0
  44. data/lib/carrierwave/processing/mini_magick.rb +269 -0
  45. data/lib/carrierwave/processing/rmagick.rb +282 -0
  46. data/lib/carrierwave/sanitized_file.rb +268 -0
  47. data/lib/carrierwave/storage/abstract.rb +30 -0
  48. data/lib/carrierwave/storage/file.rb +48 -0
  49. data/lib/carrierwave/storage/grid_fs.rb +96 -0
  50. data/lib/carrierwave/storage/right_s3.rb +170 -0
  51. data/lib/carrierwave/storage/s3.rb +199 -0
  52. data/lib/carrierwave/test/matchers.rb +128 -0
  53. data/lib/carrierwave/uploader/cache.rb +145 -0
  54. data/lib/carrierwave/uploader/callbacks.rb +42 -0
  55. data/lib/carrierwave/uploader/configuration.rb +122 -0
  56. data/lib/carrierwave/uploader/default_url.rb +19 -0
  57. data/lib/carrierwave/uploader/download.rb +59 -0
  58. data/lib/carrierwave/uploader/extension_whitelist.rb +37 -0
  59. data/lib/carrierwave/uploader/mountable.rb +39 -0
  60. data/lib/carrierwave/uploader/processing.rb +83 -0
  61. data/lib/carrierwave/uploader/proxy.rb +62 -0
  62. data/lib/carrierwave/uploader/remove.rb +22 -0
  63. data/lib/carrierwave/uploader/store.rb +89 -0
  64. data/lib/carrierwave/uploader/url.rb +24 -0
  65. data/lib/carrierwave/uploader/versions.rb +146 -0
  66. data/lib/carrierwave/uploader.rb +44 -0
  67. data/lib/carrierwave.rb +96 -0
  68. data/merb_generators/uploader_generator.rb +22 -0
  69. data/rails_generators/uploader/USAGE +2 -0
  70. data/rails_generators/uploader/templates/uploader.rb +47 -0
  71. data/rails_generators/uploader/uploader_generator.rb +21 -0
  72. data/script/console +10 -0
  73. data/script/destroy +14 -0
  74. data/script/generate +14 -0
  75. data/spec/compatibility/paperclip_spec.rb +52 -0
  76. data/spec/fixtures/bork.txt +1 -0
  77. data/spec/fixtures/landscape.jpg +0 -0
  78. data/spec/fixtures/portrait.jpg +0 -0
  79. data/spec/fixtures/test.jpeg +1 -0
  80. data/spec/fixtures/test.jpg +1 -0
  81. data/spec/mount_spec.rb +538 -0
  82. data/spec/orm/activerecord_spec.rb +271 -0
  83. data/spec/orm/datamapper_spec.rb +168 -0
  84. data/spec/orm/mongoid_spec.rb +206 -0
  85. data/spec/orm/mongomapper_spec.rb +202 -0
  86. data/spec/orm/sequel_spec.rb +183 -0
  87. data/spec/processing/image_science_spec.rb +56 -0
  88. data/spec/processing/mini_magick_spec.rb +76 -0
  89. data/spec/processing/rmagick_spec.rb +75 -0
  90. data/spec/sanitized_file_spec.rb +601 -0
  91. data/spec/spec_helper.rb +99 -0
  92. data/spec/storage/grid_fs_spec.rb +82 -0
  93. data/spec/storage/right_s3_spec.rb +75 -0
  94. data/spec/storage/s3_spec.rb +95 -0
  95. data/spec/uploader/cache_spec.rb +209 -0
  96. data/spec/uploader/configuration_spec.rb +105 -0
  97. data/spec/uploader/default_url_spec.rb +85 -0
  98. data/spec/uploader/download_spec.rb +75 -0
  99. data/spec/uploader/extension_whitelist_spec.rb +44 -0
  100. data/spec/uploader/mountable_spec.rb +33 -0
  101. data/spec/uploader/paths_spec.rb +22 -0
  102. data/spec/uploader/processing_spec.rb +73 -0
  103. data/spec/uploader/proxy_spec.rb +54 -0
  104. data/spec/uploader/remove_spec.rb +70 -0
  105. data/spec/uploader/store_spec.rb +248 -0
  106. data/spec/uploader/url_spec.rb +87 -0
  107. data/spec/uploader/versions_spec.rb +298 -0
  108. metadata +351 -0
@@ -0,0 +1,538 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/spec_helper'
4
+
5
+ describe CarrierWave::Mount do
6
+
7
+ after do
8
+ FileUtils.rm_rf(public_path)
9
+ end
10
+
11
+ describe '.mount_uploader' do
12
+
13
+ before do
14
+ @class = Class.new
15
+ @class.send(:extend, CarrierWave::Mount)
16
+
17
+ @uploader = Class.new(CarrierWave::Uploader::Base)
18
+
19
+ @class.mount_uploader(:image, @uploader)
20
+ @instance = @class.new
21
+ end
22
+
23
+ it "should maintain the ability to super" do
24
+ @class.class_eval do
25
+ def image_uploader
26
+ super
27
+ end
28
+
29
+ def image=(val)
30
+ super
31
+ end
32
+ end
33
+
34
+ @instance.image = stub_file('test.jpg')
35
+ @instance.image.should be_an_instance_of(@uploader)
36
+ end
37
+
38
+ it "should inherit uploaders to subclasses" do
39
+ @subclass = Class.new(@class)
40
+ @subclass_instance = @subclass.new
41
+ @subclass_instance.image = stub_file('test.jpg')
42
+ @subclass_instance.image.should be_an_instance_of(@uploader)
43
+ end
44
+
45
+ describe '#image' do
46
+
47
+ it "should return a blank uploader when nothing has been assigned" do
48
+ @instance.should_receive(:read_uploader).with(:image).twice.and_return(nil)
49
+ @instance.image.should be_an_instance_of(@uploader)
50
+ @instance.image.should be_blank
51
+ end
52
+
53
+ it "should return a blank uploader when an empty string has been assigned" do
54
+ @instance.should_receive(:read_uploader).with(:image).twice.and_return('')
55
+ @instance.image.should be_an_instance_of(@uploader)
56
+ @instance.image.should be_blank
57
+ end
58
+
59
+ it "should retrieve a file from the storage if a value is stored in the database" do
60
+ @instance.should_receive(:read_uploader).with(:image).at_least(:once).and_return('test.jpg')
61
+ @instance.image.should be_an_instance_of(@uploader)
62
+ end
63
+
64
+ it "should set the path to the store dir" do
65
+ @instance.should_receive(:read_uploader).with(:image).at_least(:once).and_return('test.jpg')
66
+ @instance.image.current_path.should == public_path('uploads/test.jpg')
67
+ end
68
+
69
+ end
70
+
71
+ describe '#image=' do
72
+
73
+ it "should cache a file" do
74
+ @instance.image = stub_file('test.jpg')
75
+ @instance.image.should be_an_instance_of(@uploader)
76
+ end
77
+
78
+ it "should copy a file into into the cache directory" do
79
+ @instance.image = stub_file('test.jpg')
80
+ @instance.image.current_path.should =~ /^#{public_path('uploads/tmp')}/
81
+ end
82
+
83
+ it "should do nothing when nil is assigned" do
84
+ @instance.should_not_receive(:write_uploader)
85
+ @instance.image = nil
86
+ end
87
+
88
+ it "should do nothing when an empty string is assigned" do
89
+ @instance.should_not_receive(:write_uploader)
90
+ @instance.image = stub_file('test.jpg')
91
+ end
92
+
93
+ it "should fail silently if the image fails an integrity check" do
94
+ @uploader.class_eval do
95
+ def extension_white_list
96
+ %(txt)
97
+ end
98
+ end
99
+ @instance.image = stub_file('test.jpg')
100
+ @instance.image.should be_blank
101
+ end
102
+
103
+ it "should fail silently if the image fails to be processed" do
104
+ @uploader.class_eval do
105
+ process :monkey
106
+ def monkey
107
+ raise CarrierWave::ProcessingError, "Ohh noez!"
108
+ end
109
+ end
110
+ @instance.image = stub_file('test.jpg')
111
+ end
112
+
113
+ end
114
+
115
+ describe '#image?' do
116
+
117
+ it "should be false when nothing has been assigned" do
118
+ @instance.should_receive(:read_uploader).with(:image).and_return(nil)
119
+ @instance.image?.should be_false
120
+ end
121
+
122
+ it "should be false when an empty string has been assigned" do
123
+ @instance.should_receive(:read_uploader).with(:image).and_return('')
124
+ @instance.image?.should be_false
125
+ end
126
+
127
+ it "should be true when a file has been cached" do
128
+ @instance.image = stub_file('test.jpg')
129
+ @instance.image?.should be_true
130
+ end
131
+
132
+ end
133
+
134
+ describe '#image_url' do
135
+
136
+ it "should return nil when nothing has been assigned" do
137
+ @instance.should_receive(:read_uploader).with(:image).and_return(nil)
138
+ @instance.image_url.should be_nil
139
+ end
140
+
141
+ it "should return nil when an empty string has been assigned" do
142
+ @instance.should_receive(:read_uploader).with(:image).and_return('')
143
+ @instance.image_url.should be_nil
144
+ end
145
+
146
+ it "should get the url from a retrieved file" do
147
+ @instance.should_receive(:read_uploader).at_least(:once).with(:image).and_return('test.jpg')
148
+ @instance.image_url.should == '/uploads/test.jpg'
149
+ end
150
+
151
+ it "should get the url from a cached file" do
152
+ @instance.image = stub_file('test.jpg')
153
+ @instance.image_url.should =~ %r{uploads/tmp/[\d\-]+/test.jpg}
154
+ end
155
+
156
+ it "should get the url from a cached file's version" do
157
+ @uploader.version(:thumb)
158
+ @instance.image = stub_file('test.jpg')
159
+ @instance.image_url(:thumb).should =~ %r{uploads/tmp/[\d\-]+/thumb_test.jpg}
160
+ end
161
+
162
+ end
163
+
164
+ describe '#image_cache' do
165
+
166
+ before do
167
+ @instance.stub!(:write_uploader)
168
+ @instance.stub!(:read_uploader).and_return(nil)
169
+ end
170
+
171
+ it "should return nil when nothing has been assigned" do
172
+ @instance.image_cache.should be_nil
173
+ end
174
+
175
+ it "should be nil when a file has been stored" do
176
+ @instance.image = stub_file('test.jpg')
177
+ @instance.image.store!
178
+ @instance.image_cache.should be_nil
179
+ end
180
+
181
+ it "should be the cache name when a file has been cached" do
182
+ @instance.image = stub_file('test.jpg')
183
+ @instance.image_cache.should =~ %r(^[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}/test\.jpg$)
184
+ end
185
+
186
+ end
187
+
188
+ describe '#image_cache=' do
189
+
190
+ before do
191
+ @instance.stub!(:write_uploader)
192
+ @instance.stub!(:read_uploader).and_return(nil)
193
+ CarrierWave::SanitizedFile.new(file_path('test.jpg')).copy_to(public_path('uploads/tmp/19990512-1202-123-1234/test.jpg'))
194
+ end
195
+
196
+ it "should do nothing when nil is assigned" do
197
+ @instance.image_cache = nil
198
+ @instance.image.should be_blank
199
+ end
200
+
201
+ it "should do nothing when an empty string is assigned" do
202
+ @instance.image_cache = ''
203
+ @instance.image.should be_blank
204
+ end
205
+
206
+ it "retrieve from cache when a cache name is assigned" do
207
+ @instance.image_cache = '19990512-1202-123-1234/test.jpg'
208
+ @instance.image.current_path.should == public_path('uploads/tmp/19990512-1202-123-1234/test.jpg')
209
+ end
210
+
211
+ it "should not write over a previously assigned file" do
212
+ @instance.image = stub_file('test.jpg')
213
+ @instance.image_cache = '19990512-1202-123-1234/monkey.jpg'
214
+ @instance.image.current_path.should =~ /test.jpg$/
215
+ end
216
+ end
217
+
218
+ describe '#remote_image_url' do
219
+ before do
220
+ response = mock('HTTP Response')
221
+ response.stub!(:body).and_return('Response Body')
222
+ Net::HTTP.stub!(:get_response).and_return(response)
223
+ end
224
+
225
+ it "should return nil" do
226
+ @instance.remote_image_url.should be_nil
227
+ end
228
+
229
+ it "should return previously cached URL" do
230
+ @instance.remote_image_url = 'http://www.example.com/funky/monkey.png'
231
+ @instance.remote_image_url.should == 'http://www.example.com/funky/monkey.png'
232
+ end
233
+ end
234
+
235
+ describe '#remote_image_url=' do
236
+ before do
237
+ response = mock('HTTP Response')
238
+ response.stub!(:body).and_return('Response Body')
239
+ Net::HTTP.stub!(:get_response).and_return(response)
240
+ end
241
+
242
+ it "should do nothing when nil is assigned" do
243
+ @instance.remote_image_url = nil
244
+ @instance.image.should be_blank
245
+ end
246
+
247
+ it "should do nothing when an empty string is assigned" do
248
+ @instance.remote_image_url = ''
249
+ @instance.image.should be_blank
250
+ end
251
+
252
+ it "retrieve from cache when a cache name is assigned" do
253
+ @instance.remote_image_url = 'http://www.example.com/funky/monkey.png'
254
+ @instance.image.current_path.should =~ /monkey.png$/
255
+ end
256
+
257
+ it "should not write over a previously assigned file" do
258
+ @instance.image = stub_file('test.jpg')
259
+ @instance.remote_image_url = '19990512-1202-123-1234/monkey.jpg'
260
+ @instance.image.current_path.should =~ /test.jpg$/
261
+ end
262
+ end
263
+
264
+ describe '#store_image!' do
265
+
266
+ before do
267
+ @instance.stub!(:write_uploader)
268
+ @instance.stub!(:read_uploader).and_return(nil)
269
+ end
270
+
271
+ it "should do nothing when no file has been uploaded" do
272
+ @instance.store_image!
273
+ @instance.image.should be_blank
274
+ end
275
+
276
+ it "store an assigned file" do
277
+ @instance.image = stub_file('test.jpg')
278
+ @instance.store_image!
279
+ @instance.image.current_path.should == public_path('uploads/test.jpg')
280
+ end
281
+
282
+ it "should remove an uploaded file when remove_image? returns true" do
283
+ @instance.image = stub_file('test.jpg')
284
+ path = @instance.image.current_path
285
+ @instance.remove_image = true
286
+ @instance.store_image!
287
+ @instance.image.should be_blank
288
+ File.exist?(path).should be_false
289
+ end
290
+ end
291
+
292
+ describe '#remove_image!' do
293
+
294
+ before do
295
+ @instance.stub!(:write_uploader)
296
+ @instance.stub!(:read_uploader).and_return(nil)
297
+ end
298
+
299
+ it "should do nothing when no file has been uploaded" do
300
+ @instance.remove_image!
301
+ @instance.image.should be_blank
302
+ end
303
+
304
+ it "should remove an uploaded file" do
305
+ @instance.image = stub_file('test.jpg')
306
+ path = @instance.image.current_path
307
+ @instance.remove_image!
308
+ @instance.image.should be_blank
309
+ File.exist?(path).should be_false
310
+ end
311
+ end
312
+
313
+ describe '#remove_image' do
314
+
315
+ it "should store a value" do
316
+ @instance.remove_image = true
317
+ @instance.remove_image.should be_true
318
+ end
319
+
320
+ end
321
+
322
+ describe '#remove_image?' do
323
+
324
+ it "should be true when the value is truthy" do
325
+ @instance.remove_image = true
326
+ @instance.remove_image?.should be_true
327
+ end
328
+
329
+ it "should be false when the value is falsey" do
330
+ @instance.remove_image = false
331
+ @instance.remove_image?.should be_false
332
+ end
333
+
334
+ it "should be false when the value is ''" do
335
+ @instance.remove_image = ''
336
+ @instance.remove_image?.should be_false
337
+ end
338
+
339
+ it "should be false when the value is '0'" do
340
+ @instance.remove_image = '0'
341
+ @instance.remove_image?.should be_false
342
+ end
343
+
344
+ it "should be false when the value is 'false'" do
345
+ @instance.remove_image = 'false'
346
+ @instance.remove_image?.should be_false
347
+ end
348
+
349
+ end
350
+
351
+ describe '#image_integrity_error' do
352
+
353
+ it "should be nil by default" do
354
+ @instance.image_integrity_error.should be_nil
355
+ end
356
+
357
+ it "should be nil after a file is cached" do
358
+ @instance.image = stub_file('test.jpg')
359
+ @instance.image_integrity_error.should be_nil
360
+ end
361
+
362
+ it "should be an error instance after an integrity check has failed" do
363
+ @uploader.class_eval do
364
+ def extension_white_list
365
+ %(txt)
366
+ end
367
+ end
368
+ @instance.image = stub_file('test.jpg')
369
+ @instance.image_integrity_error.should be_an_instance_of(CarrierWave::IntegrityError)
370
+ end
371
+ end
372
+
373
+ describe '#image_processing_error' do
374
+
375
+ it "should be nil by default" do
376
+ @instance.image_processing_error.should be_nil
377
+ end
378
+
379
+ it "should be nil after a file is cached" do
380
+ @instance.image = stub_file('test.jpg')
381
+ @instance.image_processing_error.should be_nil
382
+ end
383
+
384
+ it "should be an error instance after an integrity check has failed" do
385
+ @uploader.class_eval do
386
+ process :monkey
387
+ def monkey
388
+ raise CarrierWave::ProcessingError, "Ohh noez!"
389
+ end
390
+ end
391
+ @instance.image = stub_file('test.jpg')
392
+ @instance.image_processing_error.should be_an_instance_of(CarrierWave::ProcessingError)
393
+ end
394
+ end
395
+
396
+ describe '#write_image_identifier' do
397
+ it "should write to the column" do
398
+ @instance.should_receive(:write_uploader).with(:image, "test.jpg")
399
+ @instance.image = stub_file('test.jpg')
400
+ @instance.write_image_identifier
401
+ end
402
+
403
+ it "should remove from the column when remove_image is true" do
404
+ @instance.image = stub_file('test.jpg')
405
+ @instance.store_image!
406
+ @instance.remove_image = true
407
+ @instance.should_receive(:write_uploader).with(:image, "")
408
+ @instance.write_image_identifier
409
+ end
410
+ end
411
+
412
+ end
413
+
414
+ describe '#mount_uploader with a block' do
415
+
416
+ before do
417
+ @class = Class.new
418
+ @class.send(:extend, CarrierWave::Mount)
419
+ @class.mount_uploader(:image) do
420
+ def monkey
421
+ 'blah'
422
+ end
423
+ end
424
+ @instance = @class.new
425
+ end
426
+
427
+ describe '#image' do
428
+
429
+ before do
430
+ @instance.stub!(:read_uploader).and_return('test.jpg')
431
+ end
432
+
433
+ it "should return an instance of a subclass of CarrierWave::Uploader::Base" do
434
+ @instance.image.should be_a(CarrierWave::Uploader::Base)
435
+ end
436
+
437
+ it "should set the path to the store dir" do
438
+ @instance.image.current_path.should == public_path('uploads/test.jpg')
439
+ end
440
+
441
+ it "should apply any custom modifications" do
442
+ @instance.image.monkey.should == "blah"
443
+ end
444
+
445
+ end
446
+
447
+ end
448
+
449
+ describe '#mount_uploader with :ignore_integrity_errors => false' do
450
+
451
+ before do
452
+ @class = Class.new
453
+ @class.send(:extend, CarrierWave::Mount)
454
+
455
+ @uploader = Class.new(CarrierWave::Uploader::Base)
456
+
457
+ @class.mount_uploader(:image, @uploader, :ignore_integrity_errors => false)
458
+ @instance = @class.new
459
+ end
460
+
461
+ it "should raise an error if the image fails an integrity check" do
462
+ @uploader.class_eval do
463
+ def extension_white_list
464
+ %(txt)
465
+ end
466
+ end
467
+ running {
468
+ @instance.image = stub_file('test.jpg')
469
+ }.should raise_error(CarrierWave::IntegrityError)
470
+ end
471
+
472
+ end
473
+
474
+ describe '#mount_uploader with :ignore_processing_errors => false' do
475
+
476
+ before do
477
+ @class = Class.new
478
+ @class.send(:extend, CarrierWave::Mount)
479
+
480
+ @uploader = Class.new(CarrierWave::Uploader::Base)
481
+
482
+ @class.mount_uploader(:image, @uploader, :ignore_processing_errors => false)
483
+ @instance = @class.new
484
+ end
485
+
486
+ it "should raise an error if the image fails to be processed" do
487
+ @uploader.class_eval do
488
+ process :monkey
489
+ def monkey
490
+ raise CarrierWave::ProcessingError, "Ohh noez!"
491
+ end
492
+ end
493
+ running {
494
+ @instance.image = stub_file('test.jpg')
495
+ }.should raise_error(CarrierWave::ProcessingError)
496
+ end
497
+
498
+ end
499
+
500
+ describe '#mount_uploader with :mount_on => :monkey' do
501
+
502
+
503
+ before do
504
+ @class = Class.new
505
+ @class.send(:extend, CarrierWave::Mount)
506
+
507
+ @uploader = Class.new(CarrierWave::Uploader::Base)
508
+
509
+ @class.mount_uploader(:image, @uploader, :mount_on => :monkey)
510
+ @instance = @class.new
511
+ end
512
+
513
+ describe '#image' do
514
+ it "should retrieve a file from the storage if a value is stored in the database" do
515
+ @instance.should_receive(:read_uploader).at_least(:once).with(:monkey).twice.and_return('test.jpg')
516
+ @instance.image.should be_an_instance_of(@uploader)
517
+ @instance.image.current_path.should == public_path('uploads/test.jpg')
518
+ end
519
+ end
520
+
521
+ describe '#write_image_identifier' do
522
+ it "should write to the given column" do
523
+ @instance.should_receive(:write_uploader).with(:monkey, "test.jpg")
524
+ @instance.image = stub_file('test.jpg')
525
+ @instance.write_image_identifier
526
+ end
527
+
528
+ it "should remove from the given column when remove_image is true" do
529
+ @instance.image = stub_file('test.jpg')
530
+ @instance.store_image!
531
+ @instance.remove_image = true
532
+ @instance.should_receive(:write_uploader).with(:monkey, "")
533
+ @instance.write_image_identifier
534
+ end
535
+ end
536
+ end
537
+
538
+ end