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!
Written by James D
Related protips
2 Responses
Wow! The rails + rspec error codes are a mess. This tip is really useful!!!
over 1 year ago
·
To avoid appending FactoryGirl at the beginning of every create
, also run:
[4] pry(main)> include FactoryGirl::Syntax::Methods
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Factory
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#