[rspec-users] Testing file attachment with Paperclip

Nicholas Wieland nicholas.wieland at gmail.com
Mon Jun 9 08:05:47 EDT 2008

Does someone have an example on faking a file upload for just ensuring  
it gets called, without actually uploading the file to s3.
I thought that stubbing Model.has_attached_file would be enough, but  
it doesn't seem so ...

This is what I did:

Video.stub!( :has_attached_file ).with( :name ).and_return( true )

has_attached_file is from paperclip, it gets mixed to the model.

RightAws::AwsError in 'VideosController should create a valid Video'
AWS access keys are required to operate on S3
/Users/ngw/zooppa-4/app/controllers/videos_controller.rb:6:in `create'

Maybe I missed something ?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2435 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080609/97e7ad34/attachment.bin>

More information about the rspec-users mailing list