Using fixtures with factory_girl

Posted by deb on Stack Overflow See other posts from Stack Overflow or by deb
Published on 2010-04-28T19:43:12Z Indexed on 2010/04/28 19:47 UTC
Read the original article Hit count: 192

When building the following factory:

Factory.define :user do |f|
  f.sequence(:name) { |n| "foo#{n}" }
  f.resume_type_id { ResumeType.first.id }
end

ResumeType.first returns nil and I get an error.

ResumeType records are loaded via fixtures. I checked using the console and the entries are there, the table is not empty.

I've found a similar example in the factory_girl mailing list, and it's supposed to work.

What am I missing? Do I have to somehow tell factory_girl to set up the fixtures before running the tests?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about factorygirl