factory_bot_rails: fixture_replacement in generators does not work

application.rb:

config.generators do |g|
    g.fixture_replacement :factory_girl, :dir => "spec/factories"
...

leads to:

rails g model test dummy
...
invoke      factory_girl
Could not find "fixtures.3.rb" in any of your source paths.

If I remove the fixture_replacement the rails generators work again.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

also worked for me w/ following:

Gemfile

group :development do
  gem "factory_girl_rails"
end

config/application.rb

config.generators do |g|
  g.test_framework :rspec, :fixture => true, :views => false
  g.fixture_replacement :factory_girl, :dir => "spec/factories"
end