jiga1q
Last Updated: December 02, 2017
·
6.395K
· jamesgecko

Load FactoryGirl in Rails console

Simple, yet used rarely enough to be forgettable.

$ rails c
...
[1] pry(main)> require 'factory_girl'
=> true
[2] pry(main)> FactoryGirl.find_definitions
...
[3] pry(main)> FactoryGirl.create :my_thing

Magic!

2 Responses
Add your response

10475

Wow! The rails + rspec error codes are a mess. This tip is really useful!!!

over 1 year ago ·
13459

To avoid appending FactoryGirl at the beginning of every create, also run:

[4] pry(main)> include FactoryGirl::Syntax::Methods
over 1 year ago ·