Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Factory(:some_factory) or FactoryGirl.create(:some_factory)

Is there any difference between Factory(:some_factory) and FactoryGirl.create(:some_factory)?

Factory(:some_factory) was causing ActiveRecord::AssociationTypeMismatch in one controller spec while FactoryGirl.create(:some_factory) was not causing it

like image 587
Tsvetelina Borisova Avatar asked Dec 06 '25 08:12

Tsvetelina Borisova


1 Answers

Factory(:some_factory) and Factory.create(:some_factory) were used in older versions of FactoryGirl but deprecated in favor of the current FactoryGirl.create(:some_factory) syntax.

like image 151
Patrick Lewis Avatar answered Dec 07 '25 20:12

Patrick Lewis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!