FactoryGirl with Non ActiveRecord Classes
Creating FactoryGirl
for ActiveRecord
classes is quite handy. Here we will learn creating FactoryGirl
for NonActiveRecord classes.
Assume you have a class Note
in ‘app/models’ directory
Create Factory in ‘spec/factories’ directory
We can use this factory in our specs like:
Note:
Methods like create
, save
other than new
would not work.