Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Factories are not working properly. #29

Open
richardkmichael opened this issue Oct 22, 2011 · 0 comments
Open

Factories are not working properly. #29

richardkmichael opened this issue Oct 22, 2011 · 0 comments

Comments

@richardkmichael
Copy link
Owner

Trying to save a built factory is broken, e.g.

project = Factory.build(:project)
project.save

Because the user required by the Factory built project has not yet been saved. This user is saved during Factory.create(:project).

Work around:

project = Factory.build(:project)
project.users.first.save
project.save

Also, consider moving the factories to different files:

test/factories/user.rb
test/factories/project.rb
etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant