I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload '/files/test.jpg', 'image/jpg' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" # "..../myapp/test/
fixtures/"
end
and I have my test.jpg in "..../myapp/test/fixtures/files/
test.jpg"
but running the unit test, article = FactoryGirl.build(:article,
title: nil), I get an error :
RuntimeError: files/test.jpg file does not exist
where should I put the file for 'fixture_file_upload' can find it ?
thanks for feedback
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment