ruby on rails - FactoryGirl:create the same object multiple times -
in 1 of rspec test, creating multiple objects same factory definition
eg
factorygirl.create(:model_1) factorygirl.create(:model_1) factorygirl.create(:model_1)
is there method factory_girl
provides in 1 line
i know can do
3.times {factorygirl.create(:model_1)}
but looking factory_girl
provides creating multiple objects of same model.
you can create list (hence create x objects @ once):
factorygirl.create_list(:model_1, 3)
documentation lives here.
Comments
Post a Comment