I choose refile gem to handle file uploads in my application. I have some trouble with use it with FactoryGirl. In my factory I have something like that:
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :company do
sequence(:name) { |n| "Company #{n}" }
logo_id { fixture_file_upload(Rails.root.to_s + "/spec/fixtures/images/1x1.gif") }
end
end
When I run some feature specs it returns me the following error:
5) Company destroying destroys company
Failure/Error: visit companies_path
ActionView::Template::Error:
Refile::InvalidID
EDIT: This error is caused by this line in my view template:
%td= image_tag attachment_url(company, :logo, :fill, 50, 50)