Rails3: Factory girl and file uploads

rails3 ruby edge ruby19 factory_girl


Our experience so far with rails 3 has been pretty good. Some of the modules and internals of rails were renamed, but so far we haven't experienced anything that changed drastically. Most of the stuff still have some parallelisms.

ActionController::TestProcess is now ActionDispatch::TestProcess

We had a model with a paperclip attachment, which we required the presence of. In order to specify that in our spec/support/factories.rb, we just had to do the following:

One other important detail here is that right now, Rails doesn't have the option of overriding the fixtures file path when you're using Rspec. To overcome that problem, I just had to add a file in spec/support. For our purposes we just named it 001_fixture_path.rb. As soon as RSpec and Rails fixes their integration problem, we'll just remove the file.

Next up, we're gonna share our very exciting and slightly painful experience with upgrading to RSpec 2.0.

blog comments powered by Disqus