I have this setup:
factory :agency do |a|
a.agents_attributes { [FactoryGirl.attributes_for(:agent)] }
a.subdomain 'clear'
a.name 'ClearProperty'
end
factory :agent do |a|
agency
a.email 'user@test.com'
a.password 'please'
end
Agency has_many Agents and an agency must be present. How to resolve this chicken-n-egg? I want to do Factory(:agent) but this will call Factory(:agency) which will then attempt build another agent.
agency
factory, which wouldn't create anyagent
. – apneadiving Oct 28 '11 at 10:38