Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix overridden fixture config in railtie

The railtie now only auto-adds fixture_replacement configuration if none
is detected. It also does not specify a fixtures directory, deferring
this to the generator's default instead.
  • Loading branch information...
commit 0d94362b4692a8653d99908e851d9b2ca1392fa3 1 parent f2cf240
@urbanautomaton urbanautomaton authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/factory_girl_rails/railtie.rb
View
7 lib/factory_girl_rails/railtie.rb
@@ -6,10 +6,11 @@ class Railtie < Rails::Railtie
initializer "factory_girl.set_fixture_replacement" do
generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
+ options = generators.options[:rails]
- if generators.options[:rails][:test_framework] == :rspec
- generators.fixture_replacement :factory_girl, :dir => 'spec/factories'
- else
+ if options[:test_framework] == :rspec && !options[:fixture_replacement]
+ generators.fixture_replacement :factory_girl
+ elsif options[:test_framework] != :rspec
generators.test_framework :test_unit, :fixture => false, :fixture_replacement => :factory_girl
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.