Using factory_girl Factory in test console

You would like to test your factory_girl factories in the rails test console, but you get an error when you try to use an existing factory.


  1. Start your console in the test evnivornment:
    rails c test
  2. require your factories.rb file in the console:
    require 'absolute_path/to/your/factories.rb'
  3. you should be able to use your factory now :