I am using Paperclip and S3 for image uploads and am trying to stub out calls to S3 from my test suite. I found the thoughtbot post which mentions doing
a.cover { a.paperclip_fixture('album', 'cover', 'png') }
but that gives me a "wrong number of arguments (4 for 2)" error. I tried switching the arguments above to an array, which removes the original error, but gives an error saying "Attribute already defined: paperclip_fixture".
Has anyone been able to get this working? Also, I'd ideally like to use the local filesystem for the development environment. Is there an easy way to do this?
Okay, I've got the basic issue figured out. This is (I believe) as Eliza said, because I'm not using shoulda
(I'm using rspec 2.6.0
and factory_girl 2.1.2
).
Here's what worked for me (where Profile
is the class that has attachements):
Profile.any_instance.stub(:save_attached_files).and_return(true)
@profile = Factory(:profile)
At the moment I just have this right in my before
method of my rspec
example. There's probably a better place to put it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With