I ran into your question looking for the same answer. Check this:
How to use Factory Girl to create a portfolio clip app?
Good luck
update:
So, here is what I did step by step to upload the file to my .rb factories.
a. Since I use rspec, I created a catalog inventory under spec / and catalog images in spec / fixtures /, and then placed the example.jpg image there, so the path was Rails.root / spec / fixtures / images / example.jpg
Q. Then, in my .rb factories, I changed my definition as follows:
Factory.define :image do |image| image.image fixture_file_upload( Rails.root + 'spec/fixtures/images/example.jpg', "image/jpg") image.caption "Some random caption" end
(optional: restart your spork server if in rspec)
C. Should now work fine.
Let me know if you have more problems. I will do my best to help :)
source share