Reputation: 591
I've got a model :
FactoryGirl.define do
factory :model do
mini_image { fixture_file_upload(Rails.root.join('spec', 'photos', 'rails.png'), 'image/png') }
name "Test model"
end
end
When a run rake spec, I received this error:
NoMethodError:
undefined method `fixture_file_upload'
I already add to my spec_helper this
config.include ActionDispatch::TestProcess
The only way I find to made my Factory working is to add this line at the beginning of my models.rb file, but it's not very clean :
include ActionDispatch::TestProcess
Anyone have another solution ?
Thanks
Upvotes: 3
Views: 2108
Reputation: 457
Try to add this in your spec_helper.rb
, outside of RSpec.configure
block.
FactoryGirl::SyntaxRunner.class_eval do
include ActionDispatch::TestProcess
end
Upvotes: 12