I'm trying to use Factory Girl in a rake task like this:
require 'factory_girl'
require File.expand_path("spec/factories.rb")
namespace :users do
desc "Create sample users for use in development"
task :create_sample_users => :environment do
Factory(:user, :email => "[email protected]")
Factory(:approved_user, :email => "[email protected]")
end
end
However when I run rake users:create_sample_users
I get the error uninitialized constant Entry
(Entry is the name of one of my app's classes).
Can anyone tell me how to get Factory girl to see my classes? It's working fine in my tests, just failing in my rake tasks.
require File.expand_path("spec/factories.rb")
so I don't have to include it in every task? Thanks again. – Egan