Undistraction
Undistraction

Reputation: 43401

Why Does FactoryGirl Generate Factories in the 'test' Directory When I'm Using RSpec?

When I generate a model using:

$ rails g model example

Rails generates a factory for the model. Currently it adds the factory to test/factories however I need it to add the factory to spec/factories.

I'm using RSpec and everything else is generated to spec/….

Upvotes: 1

Views: 550

Answers (1)

Danny
Danny

Reputation: 6025

Normally, the place where these files end up, is determined by a directive in the file config/application.rb:

class Application < Rails::Application
  config.generators do |g|
    ...

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

    ...
  end

...

Upvotes: 4

Related Questions