Last Updated: February 25, 2016
·
2.9K
· jamesmartin

Factory Girl in the Rails Console

Because I have to Google this every single time:

require 'factory_girl'

Dir.glob(File.join(Dir.pwd, "spec/factories/**/**/*.rb")).each do |factory|
  require factory
end
object = Factory.create(:my_factory)