如果我有一个充满工厂的文件,看起来像这样:
FactoryGirl.define do
factory :city do
name "My City"
state "MI"
latitude 50
longitude -80
association :country
end
factory :waukegan_city, class: City do
name "Waukegan"
state "IL"
latitude "42.36"
longitude "-87.81"
association :country
end
factory :amherst_oh, class: City do
name "Amherst"
state "OH"
latitude 41.36170
longitude -82.25380
association :country
end
end
我可以:
FactoryGirl.create(:city)
FactoryGirl.create(:waukegan_city)
FactoryGirl.create(:amherst_oh)
但是有没有办法一次创建所有这些(即不指定单个工厂但不在每个文件中创建所有工厂)?