次のようなファクトリでいっぱいのファイルがある場合:
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)
しかし、これらすべてを一度に作成する方法はありますか(つまり、個々のファクトリを指定せずに、すべてのファイルにすべてのファクトリを作成することなく)?