uploadcolumn 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,668 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+
3
+ gem 'activerecord'
4
+ require 'active_record'
5
+
6
+ require File.join(File.dirname(__FILE__), '../lib/upload_column')
7
+
8
+ # change this if sqlite is unavailable
9
+ dbconfig = {
10
+ :adapter => 'sqlite3',
11
+ :database => 'db/test.sqlite3'
12
+ }
13
+
14
+ ActiveRecord::Base.establish_connection(dbconfig)
15
+ ActiveRecord::Migration.verbose = false
16
+
17
+ class TestMigration < ActiveRecord::Migration
18
+ def self.up
19
+ create_table :events, :force => true do |t|
20
+ t.column :image, :string
21
+ t.column :textfile, :string
22
+ end
23
+
24
+ create_table :movies, :force => true do |t|
25
+ t.column :movie, :string
26
+ t.column :name, :string
27
+ t.column :description, :text
28
+ end
29
+
30
+ create_table :shrooms, :force => true do |t|
31
+ t.column :image, :string
32
+ t.column :image_size, :integer
33
+ t.column :image_public_path, :string
34
+ t.column :image_path, :string
35
+ t.column :image_monkey, :string
36
+ t.column :image_extension, :string
37
+ end
38
+ end
39
+
40
+ def self.down
41
+ drop_table :events
42
+ drop_table :movies
43
+ drop_table :shrooms
44
+ end
45
+ end
46
+
47
+ class Event < ActiveRecord::Base; end # setup a basic AR class for testing
48
+ class Movie < ActiveRecord::Base; end # setup a basic AR class for testing
49
+ class Shroom < ActiveRecord::Base; end # setup a basic AR class for testing
50
+
51
+ def migrate
52
+ before(:all) do
53
+ TestMigration.down rescue nil
54
+ TestMigration.up
55
+ end
56
+
57
+ after(:all) { TestMigration.down }
58
+ end
59
+
60
+ # TODO: RSpec syntax and integration really don't mix. In the long run, it would
61
+ # be nice to rewrite this stuff with the Story runner.
62
+
63
+ describe "normally instantiating and saving a record" do
64
+
65
+ migrate
66
+
67
+ it "shouldn't fail" do
68
+ Event.reflect_on_upload_columns.should == {}
69
+ running { @event = Event.new }.should_not raise_error
70
+ @event.image = "monkey"
71
+ running { @event.save }.should_not raise_error
72
+ end
73
+
74
+ end
75
+
76
+ describe "uploading a single file" do
77
+
78
+ migrate
79
+
80
+ before do
81
+ Event.upload_column(:image)
82
+ @event = Event.new
83
+ @event.image = stub_tempfile('kerb.jpg')
84
+ end
85
+
86
+ it "should set the correct path" do
87
+ @event.image.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb.jpg' )
88
+ end
89
+
90
+ it "should copy the file to temp." do
91
+ File.exists?(@event.image.path).should === true
92
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
93
+ end
94
+
95
+ it "should set the correct url" do
96
+ @event.image.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb.jpg}
97
+ end
98
+
99
+ after do
100
+ FileUtils.rm_rf(PUBLIC)
101
+ end
102
+ end
103
+
104
+ describe "uploading a file and then saving the record" do
105
+
106
+ migrate
107
+
108
+ before do
109
+ Event.upload_column(:image)
110
+ @event = Event.new
111
+ @event.image = stub_tempfile('kerb.jpg')
112
+ @event.save
113
+ end
114
+
115
+ it "should set the correct path" do
116
+ @event.image.path.should match_path(PUBLIC, 'image', 'kerb.jpg')
117
+ end
118
+
119
+ it "should copy the file to the correct location" do
120
+ File.exists?(@event.image.path)
121
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
122
+ end
123
+
124
+ it "should set the correct url" do
125
+ @event.image.url.should == "/image/kerb.jpg"
126
+ end
127
+
128
+ it "should save the filename to the database" do
129
+ Event.find(@event.id)['image'].should == 'kerb.jpg'
130
+ end
131
+
132
+ after do
133
+ FileUtils.rm_rf(PUBLIC)
134
+ end
135
+
136
+ end
137
+
138
+ describe "uploading a file with versions" do
139
+
140
+ migrate
141
+
142
+ before do
143
+ Event.upload_column(:image, :versions => [ :thumb, :large ] )
144
+ @event = Event.new
145
+ @event.image = stub_tempfile('kerb.jpg')
146
+ end
147
+
148
+ it "should set the correct path" do
149
+ @event.image.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb.jpg' )
150
+ @event.image.thumb.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-thumb.jpg' )
151
+ @event.image.large.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-large.jpg' )
152
+ end
153
+
154
+ it "should copy the file to temp." do
155
+ File.exists?(@event.image.path).should === true
156
+ File.exists?(@event.image.thumb.path).should === true
157
+ File.exists?(@event.image.large.path).should === true
158
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
159
+ @event.image.thumb.path.should be_identical_with(file_path('kerb.jpg'))
160
+ @event.image.large.path.should be_identical_with(file_path('kerb.jpg'))
161
+ end
162
+
163
+ it "should set the correct url" do
164
+ @event.image.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb.jpg}
165
+ @event.image.thumb.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-thumb.jpg}
166
+ @event.image.large.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-large.jpg}
167
+ end
168
+
169
+ after do
170
+ FileUtils.rm_rf(PUBLIC)
171
+ end
172
+
173
+ end
174
+
175
+ describe "uploading a file with versions and then saving the record" do
176
+
177
+ migrate
178
+
179
+ before do
180
+ Event.upload_column(:image, :versions => [ :thumb, :large ] )
181
+ @event = Event.new
182
+ @event.image = stub_tempfile('kerb.jpg')
183
+ @event.save
184
+ end
185
+
186
+ it "should set the correct path" do
187
+ @event.image.path.should match_path(PUBLIC, 'image', 'kerb.jpg' )
188
+ @event.image.thumb.path.should match_path(PUBLIC, 'image', 'kerb-thumb.jpg' )
189
+ @event.image.large.path.should match_path(PUBLIC, 'image', 'kerb-large.jpg' )
190
+ end
191
+
192
+ it "should copy the file to the correct location." do
193
+ File.exists?(@event.image.path).should === true
194
+ File.exists?(@event.image.thumb.path).should === true
195
+ File.exists?(@event.image.large.path).should === true
196
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
197
+ @event.image.thumb.path.should be_identical_with(file_path('kerb.jpg'))
198
+ @event.image.large.path.should be_identical_with(file_path('kerb.jpg'))
199
+ end
200
+
201
+ it "should set the correct url" do
202
+ @event.image.url.should == "/image/kerb.jpg"
203
+ @event.image.thumb.url.should == "/image/kerb-thumb.jpg"
204
+ @event.image.large.url.should == "/image/kerb-large.jpg"
205
+ end
206
+
207
+ it "should save the filename to the database" do
208
+ Event.find(@event.id)['image'].should == 'kerb.jpg'
209
+ end
210
+
211
+ after do
212
+ FileUtils.rm_rf(PUBLIC)
213
+ end
214
+
215
+ end
216
+
217
+
218
+ describe "assigning a file from temp with versions" do
219
+
220
+ migrate
221
+
222
+ before do
223
+ Event.upload_column(:image, :versions => [ :thumb, :large ] )
224
+ @blah = Event.new
225
+
226
+ @event = Event.new
227
+
228
+ @blah.image = stub_tempfile('kerb.jpg') # we've alredy tested this...
229
+
230
+ @event.image_temp = @blah.image_temp
231
+ end
232
+
233
+ it "should set the correct path" do
234
+ @event.image.path.should == @blah.image.path
235
+ @event.image.thumb.path.should == @blah.image.thumb.path
236
+ @event.image.large.path.should == @blah.image.large.path
237
+ end
238
+
239
+ it "should set the correct url" do
240
+ @event.image.url.should == @blah.image.url
241
+ @event.image.thumb.url.should == @blah.image.thumb.url
242
+ @event.image.large.url.should == @blah.image.large.url
243
+ end
244
+
245
+ after do
246
+ FileUtils.rm_rf(PUBLIC)
247
+ end
248
+
249
+ end
250
+
251
+
252
+ describe "assigning a file from temp with versions and then saving the record" do
253
+
254
+ migrate
255
+
256
+ before do
257
+ Event.upload_column(:image, :versions => [ :thumb, :large ] )
258
+ @blah = Event.new
259
+
260
+ @event = Event.new
261
+
262
+ @blah.image = stub_tempfile('kerb.jpg') # we've alredy tested this...
263
+
264
+ @event.image_temp = @blah.image_temp
265
+
266
+ @event.save
267
+ end
268
+
269
+ it "should set the correct path" do
270
+ @event.image.path.should match_path(PUBLIC, 'image', 'kerb.jpg' )
271
+ @event.image.thumb.path.should match_path(PUBLIC, 'image', 'kerb-thumb.jpg' )
272
+ @event.image.large.path.should match_path(PUBLIC, 'image', 'kerb-large.jpg' )
273
+ end
274
+
275
+ it "should copy the file to the correct location." do
276
+ File.exists?(@event.image.path).should === true
277
+ File.exists?(@event.image.thumb.path).should === true
278
+ File.exists?(@event.image.large.path).should === true
279
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
280
+ @event.image.thumb.path.should be_identical_with(file_path('kerb.jpg'))
281
+ @event.image.large.path.should be_identical_with(file_path('kerb.jpg'))
282
+ end
283
+
284
+ it "should set the correct url" do
285
+ @event.image.url.should == "/image/kerb.jpg"
286
+ @event.image.thumb.url.should == "/image/kerb-thumb.jpg"
287
+ @event.image.large.url.should == "/image/kerb-large.jpg"
288
+ end
289
+
290
+ it "should save the filename to the database" do
291
+ Event.find(@event.id)['image'].should == 'kerb.jpg'
292
+ end
293
+
294
+ after do
295
+ FileUtils.rm_rf(PUBLIC)
296
+ end
297
+
298
+ end
299
+
300
+ describe "an upload_column with an uploaded file" do
301
+
302
+ migrate
303
+
304
+ before do
305
+ Event.upload_column(:image)
306
+ @event = Event.new
307
+ @event.image = stub_tempfile('kerb.jpg')
308
+ @event.save
309
+ end
310
+
311
+ it "should not be overwritten by an empty String" do
312
+ @e2 = Event.find(@event.id)
313
+ lambda {
314
+ @e2.image = ""
315
+ @e2.save
316
+ }.should_not change(@e2.image, :path)
317
+ @e2[:image].should == "kerb.jpg"
318
+ end
319
+
320
+ it "should not be overwritten by an empty StringIO" do
321
+ @e2 = Event.find(@event.id)
322
+ lambda {
323
+ @e2.image = StringIO.new('')
324
+ @e2.save
325
+ }.should_not change(@e2.image, :path)
326
+ @e2[:image].should == "kerb.jpg"
327
+ end
328
+
329
+ it "should not be overwritten by an empty file" do
330
+ @e2 = Event.find(@event.id)
331
+ lambda {
332
+ file = stub_file('kerb.jpg')
333
+ file.stub!(:size).and_return(0)
334
+ @e2.image = file
335
+ @e2.save
336
+ }.should_not change(@e2.image, :path)
337
+ @e2[:image].should == "kerb.jpg"
338
+ end
339
+
340
+ it "should be overwritten by another file" do
341
+ @e2 = Event.find(@event.id)
342
+ lambda {
343
+ file = stub_file('skanthak.png')
344
+ @e2.image = file
345
+ @e2.save
346
+ }.should_not change(@e2.image, :path)
347
+ @e2[:image].should == "skanthak.png"
348
+ end
349
+
350
+ it "should be marshallable" do
351
+ running { Marshal.dump(@entry) }.should_not raise_error
352
+ end
353
+
354
+ after do
355
+ FileUtils.rm_rf(PUBLIC)
356
+ end
357
+ end
358
+
359
+ describe "uploading an image with several versions, the rmagick manipulator and instructions to rescale" do
360
+
361
+ migrate
362
+
363
+ # buuhuu so sue me. This spec runs a whole second faster if we do this before all instead of
364
+ # before each.
365
+ before(:all) do
366
+ Event.upload_column(:image,
367
+ :versions => { :thumb => 'c100x100', :large => '200x200' },
368
+ :manipulator => UploadColumn::Manipulators::RMagick
369
+ )
370
+ @event = Event.new
371
+ @event.image = stub_tempfile('kerb.jpg')
372
+ end
373
+
374
+ it "should set the correct path" do
375
+ @event.image.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb.jpg' )
376
+ @event.image.thumb.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-thumb.jpg' )
377
+ @event.image.large.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-large.jpg' )
378
+ end
379
+
380
+ it "should copy the files to temp." do
381
+ File.exists?(@event.image.path).should === true
382
+ File.exists?(@event.image.thumb.path).should === true
383
+ File.exists?(@event.image.large.path).should === true
384
+ end
385
+
386
+ it "should set the correct url" do
387
+ @event.image.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb.jpg}
388
+ @event.image.thumb.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-thumb.jpg}
389
+ @event.image.large.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-large.jpg}
390
+ end
391
+
392
+ it "should preserve the main file" do
393
+ @event.image.path.should be_identical_with(file_path('kerb.jpg'))
394
+ end
395
+
396
+ it "should change the versions" do
397
+ @event.image.thumb.path.should_not be_identical_with(file_path('kerb.jpg'))
398
+ @event.image.large.path.should_not be_identical_with(file_path('kerb.jpg'))
399
+ end
400
+
401
+ it "should rescale the images to the correct sizes" do
402
+ @event.image.large.should be_no_larger_than(200, 200)
403
+ @event.image.thumb.should have_the_exact_dimensions_of(100, 100)
404
+ end
405
+
406
+ after(:all) do
407
+ FileUtils.rm_rf(PUBLIC)
408
+ end
409
+ end
410
+
411
+
412
+ # TODO: make image_science not crap out on my macbook
413
+ #describe "uploading an image with several versions, the image_science manipulator and instructions to rescale" do
414
+ #
415
+ # migrate
416
+ #
417
+ # # buuhuu so sue me. This spec runs a whole second faster if we do this before all instead of
418
+ # # before each.
419
+ # before(:all) do
420
+ # Event.upload_column(:image,
421
+ # :versions => { :thumb => 'c100x100', :large => '200x200' },
422
+ # :manipulator => UploadColumn::Manipulators::ImageScience
423
+ # )
424
+ # @event = Event.new
425
+ # @event.image = stub_tempfile('kerb.jpg')
426
+ # end
427
+ #
428
+ # it "should set the correct path" do
429
+ # @event.image.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb.jpg' )
430
+ # @event.image.thumb.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-thumb.jpg' )
431
+ # @event.image.large.path.should match_path(PUBLIC, 'tmp', /(?:\d+\.)+\d+/, 'kerb-large.jpg' )
432
+ # end
433
+ #
434
+ # it "should copy the files to temp." do
435
+ # File.exists?(@event.image.path).should === true
436
+ # File.exists?(@event.image.thumb.path).should === true
437
+ # File.exists?(@event.image.large.path).should === true
438
+ # end
439
+ #
440
+ # it "should set the correct url" do
441
+ # @event.image.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb.jpg}
442
+ # @event.image.thumb.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-thumb.jpg}
443
+ # @event.image.large.url.should =~ %r{/tmp/(?:\d+\.)+\d+/kerb-large.jpg}
444
+ # end
445
+ #
446
+ # it "should preserve the main file" do
447
+ # @event.image.path.should be_identical_with(file_path('kerb.jpg'))
448
+ # end
449
+ #
450
+ # it "should change the versions" do
451
+ # @event.image.thumb.path.should_not be_identical_with(file_path('kerb.jpg'))
452
+ # @event.image.large.path.should_not be_identical_with(file_path('kerb.jpg'))
453
+ # end
454
+ #
455
+ # it "should rescale the images to the correct sizes" do
456
+ # @event.image.large.should be_no_larger_than(200, 200)
457
+ # @event.image.thumb.should have_the_exact_dimensions_of(100, 100)
458
+ # end
459
+ #
460
+ # after(:all) do
461
+ # FileUtils.rm_rf(PUBLIC)
462
+ # end
463
+ #end
464
+
465
+ describe "uploading a file with an extension that is not in the whitelist" do
466
+
467
+ migrate
468
+
469
+ before(:each) do
470
+ Event.upload_column(:image, :fix_file_extensions => false)
471
+ Event.validates_integrity_of :image
472
+
473
+ @event = Event.new
474
+ end
475
+
476
+ it "should add an error to the record" do
477
+ @event.image = stub_tempfile('kerb.jpg', nil, 'monkey.exe')
478
+ @event.should_not be_valid
479
+ @event.errors.on(:image).should == "has an extension that is not allowed."
480
+ @event.image.should be_nil
481
+ end
482
+
483
+ it "should be reversible by uploading a valid file" do
484
+
485
+ @event.image = stub_tempfile('kerb.jpg', nil, 'monkey.exe')
486
+
487
+ @event.should_not be_valid
488
+ @event.errors.on(:image).should include('has an extension that is not allowed.')
489
+
490
+ @event.image = stub_tempfile('kerb.jpg')
491
+
492
+ @event.should be_valid
493
+ @event.errors.on(:image).should be_nil
494
+ end
495
+ end
496
+
497
+ describe "uploading a file with magic columns" do
498
+
499
+ migrate
500
+
501
+ before(:each) do
502
+ Shroom.upload_column :image
503
+ @shroom = Shroom.new
504
+ @shroom.image = stub_tempfile('kerb.jpg')
505
+ end
506
+
507
+ it "should automatically set the image path" do
508
+ @shroom.image_path.should == @shroom.image.path
509
+ end
510
+
511
+ it "should automatically set the image size" do
512
+ @shroom.image_size.should == @shroom.image.size
513
+ end
514
+
515
+ it "should automatically set the image public path" do
516
+ @shroom.image_public_path.should == @shroom.image.public_path
517
+ end
518
+
519
+ it "should ignore columns whose names aren't methods on the column" do
520
+ @shroom.image_monkey.should == nil
521
+ end
522
+ end
523
+
524
+ describe "assigning a file from tmp with magic columns" do
525
+
526
+ migrate
527
+
528
+ before(:each) do
529
+ Shroom.upload_column :image
530
+ e1 = Shroom.new
531
+ e1.image = stub_tempfile('kerb.jpg')
532
+ @shroom = Shroom.new
533
+ @shroom.image_temp = e1.image_temp
534
+ end
535
+
536
+ it "should automatically set the image size" do
537
+ @shroom.image_size.should == @shroom.image.size
538
+ end
539
+
540
+ it "should automatically set the image path" do
541
+ @shroom.image_path.should == @shroom.image.path
542
+ end
543
+
544
+ it "should automatically set the image public path" do
545
+ @shroom.image_public_path.should == @shroom.image.public_path
546
+ end
547
+
548
+ it "should ignore columns whose names aren't methods on the column" do
549
+ @shroom.image_monkey.should == nil
550
+ end
551
+ end
552
+
553
+ describe "uploading and saving a file with magic columns" do
554
+
555
+ migrate
556
+
557
+ before(:each) do
558
+ Shroom.upload_column :image
559
+ @shroom = Shroom.new
560
+ @shroom.image_extension = "Some other Extension"
561
+ @shroom.image = stub_tempfile('kerb.jpg')
562
+ @shroom.save
563
+ end
564
+
565
+ it "should automatically set the image size" do
566
+ @shroom.image_size.should == @shroom.image.size
567
+ end
568
+
569
+ it "should automatically set the image path" do
570
+ @shroom.image_path.should == @shroom.image.path
571
+ end
572
+
573
+ it "should automatically set the image public path" do
574
+ @shroom.image_public_path.should == @shroom.image.public_path
575
+ end
576
+
577
+ it "should ignore columns whose names aren't methods on the column" do
578
+ @shroom.image_monkey.should == nil
579
+ end
580
+
581
+ it "should ignore columns who already have a value set" do
582
+ @shroom.image_extension.should == "Some other Extension"
583
+ end
584
+ end
585
+
586
+ describe "assigning a file from tmp and saving it with magic columns" do
587
+
588
+ migrate
589
+
590
+ before(:each) do
591
+ Shroom.upload_column :image
592
+ e1 = Shroom.new
593
+ e1.image = stub_tempfile('kerb.jpg')
594
+ @shroom = Shroom.new
595
+ @shroom.image_temp = e1.image_temp
596
+ @shroom.save
597
+ end
598
+
599
+ it "should automatically set the image size" do
600
+ @shroom.image_size.should == @shroom.image.size
601
+ end
602
+
603
+ it "should automatically set the image path" do
604
+ @shroom.image_path.should == @shroom.image.path
605
+ end
606
+
607
+ it "should automatically set the image public path" do
608
+ @shroom.image_public_path.should == @shroom.image.public_path
609
+ end
610
+
611
+ it "should ignore columns whose names aren't methods on the column" do
612
+ @shroom.image_monkey.should == nil
613
+ end
614
+ end
615
+
616
+ describe "uploading a file with a filename instruction" do
617
+
618
+ migrate
619
+
620
+ before(:each) do
621
+ Event.upload_column :image, :filename => 'arg.png'
622
+ @event = Event.new
623
+ @event.image = stub_tempfile('kerb.jpg')
624
+ @event.save
625
+ end
626
+
627
+ it "should give it the correct filename" do
628
+ @event.image.filename.should == 'arg.png'
629
+ end
630
+
631
+ it "should give it the correct path" do
632
+ @event.image.path.should match_path(PUBLIC, 'image', 'arg.png')
633
+ end
634
+ end
635
+
636
+ describe "uploading a file with a complex filename instruction" do
637
+
638
+ migrate
639
+
640
+ before(:each) do
641
+ Movie.upload_column :image, :filename => proc{ |r, f| "#{r.name}-#{f.basename}-#{f.suffix}quox.#{f.extension}"}, :versions => [:thumb, :large]
642
+ @movie = Movie.new
643
+ @movie.name = "indiana_jones"
644
+ @movie.image = stub_tempfile('kerb.jpg')
645
+ @movie.save
646
+ end
647
+
648
+ it "should give it the correct filename" do
649
+ @movie.image.filename.should == 'indiana_jones-kerb-quox.jpg'
650
+ @movie.image.thumb.filename.should == 'indiana_jones-kerb-thumbquox.jpg'
651
+ @movie.image.large.filename.should == 'indiana_jones-kerb-largequox.jpg'
652
+ end
653
+
654
+ it "should have correct paths" do
655
+ @movie.image.path.should match_path(PUBLIC, 'image', 'indiana_jones-kerb-quox.jpg' )
656
+ @movie.image.thumb.path.should match_path(PUBLIC, 'image', 'indiana_jones-kerb-thumbquox.jpg' )
657
+ @movie.image.large.path.should match_path(PUBLIC, 'image', 'indiana_jones-kerb-largequox.jpg' )
658
+ end
659
+
660
+ it "should remember the original filename" do
661
+ @movie.image.actual_filename.should == "kerb.jpg"
662
+ end
663
+
664
+ it "should store the _original_ filename in the database" do
665
+ @movie[:image].should == "kerb.jpg"
666
+ end
667
+
668
+ end