Trevor Turk
unread,Mar 11, 2009, 4:41:31 PM3/11/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Paperclip Plugin
I was getting complaints from my coworkers about slow running tests,
and I dug into Paperclip a little to try to speed them up. I'm just
using Test::Unit, and I'm now stubbing out some calls like so:
setup do
Photo.any_instance.stubs(:save_attached_files).returns(true)
Photo.any_instance.stubs(:delete_attached_files).returns(true)
Paperclip::Attachment.any_instance.stubs(:post_process).returns
(true)
end
Stubbing out the post_process method has sped up my tests a LOT. They
went from 39 seconds to 6 seconds.
I believe this is just bypassing the thumbnail creation, so it has
some impact on the quality of the tests, but it seems worth it for the
speed gains. I'm wondering if anyone thinks it's stubbing out too
much, though.
I have a separate "remote" test directory that does actual full-stack
testing with s3 and all that, so I figure I'm still pretty well
covered.
Anyway, let me know if you decide to try something similar. Any
thoughts or feedback would be appreciated!
- Trevor