richardkmichael / buy-my-beer

Make broken builds a thing of the past! Broken builds cost you a beer!
1 stars 0 forks source link

Factories are not working properly. #29

Open richardkmichael opened 13 years ago

richardkmichael commented 13 years ago

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.