[rspec-users] Testing file attachment with Paperclip

Nick Hoffman nick at deadorange.com
Sat Jan 17 10:12:09 EST 2009


On 2009-01-17, at 05:10, Fernando Perez wrote:
>> G'day again Fernando. IIRC, Paperclip's #save_attached_files is what
>> takes care of saving the attachment to disk, uploading it to S3, etc.
>> Here's a small gist that tests the allowance of JPG files, and  
>> ensures
>> that the file isn't saved [to disk, for me]:
>> http://gist.github.com/48264
>>
>> I hope that helps!
>> Nick
>
> Hi Nick,
>
> Don't ask me why, but this morning I tried once again to simply do:
> product.image = File.new('path_to_image.png'), and it worked perfectly
> as expected and passed validations and whatever.

I'm glad you got it sorted out  =)



More information about the rspec-users mailing list