mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
parent
4defe4c666
commit
d5a435dab0
2 changed files with 16 additions and 1 deletions
|
@ -83,3 +83,18 @@ Feature:
|
|||
Then the following files should not exist:
|
||||
| test/factories/users.rb |
|
||||
| spec/factories/users.rb |
|
||||
|
||||
Scenario: Use a suffix with the Factory Girl generator
|
||||
When I add "rspec-rails" as a dependency
|
||||
When I configure the factories as:
|
||||
"""
|
||||
config.generators do |g|
|
||||
g.factory_girl suffix: 'suffix'
|
||||
end
|
||||
"""
|
||||
And I run `bundle install` with a clean environment
|
||||
And I run `bundle exec rails generate model User name:string` with a clean environment
|
||||
Then the following files should exist:
|
||||
| spec/factories/users_suffix.rb |
|
||||
Then the following files should not exist:
|
||||
| spec/factories/users.rb |
|
||||
|
|
|
@ -16,7 +16,7 @@ module FactoryGirlRails
|
|||
end
|
||||
|
||||
def factory_girl_directory
|
||||
@generators.options.fetch(:factory_girl, { dir: 'spec/factories' })[:dir]
|
||||
@generators.options.fetch(:factory_girl, {}).fetch(:dir, 'spec/factories')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue