JetThoughts

Change Factory Girl directory path for Rails 3 generator

September 24th 2011

After setup rails 3.1 + Rspec + FactoryGirl, all factories are generated to test/factories instead spec/factories. Solution is to add to your application.rb:

g.fixture_replacement :factory_girl, :dir => 'spec/factories'

So we have:

1 config.generators do |g|
2   g.template_engine :haml
3   g.test_framework :rspec, :fixture_replacement => :factory_girl, :views => false, :helper => false
4   g.view_specs false
5   g.helper_specs false
6   g.fixture_replacement :factory_girl, :dir => 'spec/factories'
7 end
blog comments powered by Disqus

Powered by Rackspace Cloud Computing