Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- Factory.define :valid_thing, :class => Thing do |t|
- t.name 'Some valid thing'
- t.user { Factory(:valid_user) }
- end
- </pre>
- <pre>
- Wrapping the call in {} causes Factory Girl to not evaluate the code inside of the
- braces until the :valid_thing factory is created. This will force it to wait until the
- :valid_user factory has been loaded (Your example is failing because it is not yet
- loaded), it will also cause a new :valid_user to be created for each :valid_thing
- rather than having the same user for all :valid_thing's (Which is probably what you
- want).
- </pre>
Add Comment
Please, Sign In to add comment