Is it possible to make attachment_fu upload to use :file_system for storage during tests?

9 views
Skip to first unread message

Arman Mirk

unread,
Mar 8, 2013, 8:54:38 PM3/8/13
to rubyonra...@googlegroups.com
I'm using Attachment_fu for a model that has 3 attachment fields with s3
for storage.

Unit testing this model is very slow. This made me think if there is a
way to switch between storage types during testing and
development/production?

--
Posted via http://www.ruby-forum.com/.

tamouse mailing lists

unread,
Mar 8, 2013, 11:19:18 PM3/8/13
to rubyonra...@googlegroups.com
On Fri, Mar 8, 2013 at 7:54 PM, Arman Mirk <li...@ruby-forum.com> wrote:
> I'm using Attachment_fu for a model that has 3 attachment fields with s3
> for storage.
>
> Unit testing this model is very slow. This made me think if there is a
> way to switch between storage types during testing and
> development/production?

Or just mock them.

Roman Mirk

unread,
Mar 8, 2013, 11:24:56 PM3/8/13
to rubyonra...@googlegroups.com
Could you please be more specific or provide an example if possible?

Thanks

tamouse mailing lists

unread,
Mar 9, 2013, 12:09:25 AM3/9/13
to rubyonra...@googlegroups.com
On Fri, Mar 8, 2013 at 10:24 PM, Roman Mirk <li...@ruby-forum.com> wrote:
> Could you please be more specific or provide an example if possible?

Read up on rspec mocks in the RSpec book, and there are several
examples around the net.

Frederick Cheung

unread,
Mar 9, 2013, 5:45:53 AM3/9/13
to rubyonra...@googlegroups.com


On Saturday, March 9, 2013 1:54:38 AM UTC, Ruby-Forum.com User wrote:
I'm using Attachment_fu for a model that has 3 attachment fields with s3
for storage.

Unit testing this model is very slow. This made me think if there is a
way to switch between storage types during testing and
development/production?

Attachment_fu is a little old school, but there's no reason you couldn't do something like

    has_attachment :storage => (Rails.env.production? ? :s3 : :file_system)

to use s3 for production and filesystem for everything else

Fred
Reply all
Reply to author
Forward
Message has been deleted
0 new messages