jiga1q
Last Updated: December 02, 2017
·
5.426K
· 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!

Say Thanks
Respond

2 Responses
Add your response

10475
100 2223

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

over 1 year ago ·
13459
058744c91d324bf29bb5423b5ce7bdde

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

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