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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -