I have a model Foo that has_many \'Bar\'. I have a factory_girl factory for each of these objects. The factory for Bar has an association to Foo; it will instan
Foo
Using factory_girl-4.5.0, create n child objects in a parent object factory
factory_girl-4.5.0
FactoryGirl.define do factory :foo do name "test" after(:build) do |instance| n.times { instance.bars << FactoryGirl.create(:bar) } end end end