[rspec-users] Testing file attachment with Paperclip
lists at ruby-forum.com
Sat Sep 6 14:02:11 EDT 2008
Rick Denatale wrote:
> On Mon, Jun 9, 2008 at 8:18 AM, Nicholas Wieland
> <nicholas.wieland at gmail.com>
>> I haven't been clear enough, my point is not to fake the file upload
>> (there's also fixture_file_upload for that) but to fake the receiver, making
>> it dumb enough to avoid performing every operation on the file (in my case,
>> uploading to s3).
> I'm pretty sure the problem is that by the time you stub has_attached
> which is a class method run when the class is loaded, it's too late.
> on a quick look at the paperclip project site, it looks like what you
> to stub is the save_attached_files method on the model INSTANCE, which
> has_attached_file registers as an after_save callback.
> Rick DeNatale
> My blog on Ruby
Rick, I'm interested finding out how to do this, too (Rspec newbie and
really terrible with mocking & stubbing). Are you suggesting we do
something like this (?);
It's nice to be able to spec the app actually working with S3 but, my
specs are taking over 3 minutes now and commenting out all the S3
involved specs kinda makes me nervous!
Posted via http://www.ruby-forum.com/.
More information about the rspec-users