Ruby on Rails - defining factories for factory girl in ruby on rails- ruby on rails tutorial - rails guides - rails tutorial - ruby rails
defining factories for factory girl
If you have a ActiveRecord User class with name and email attributes, you could create a factory for it by making the FactoryGirl guess it:
Or else you can make it explicit and even change its name:
Then in your spec you can use the FactoryGirl's methods with these, like this:
The most common methods are: