mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
Update README.md
Add how-to disable factories generator and how-to change default directory. `:suffix` option is moved to `generators.factory_girl` Closes #92
This commit is contained in:
parent
90e02a3a3c
commit
8021fb5b1c
1 changed files with 12 additions and 4 deletions
16
README.md
16
README.md
|
@ -31,18 +31,26 @@ Add `factory_girl_rails` to your Gemfile:
|
|||
|
||||
gem 'factory_girl_rails'
|
||||
|
||||
Optionally, to have rails generators automatically generate factories instead
|
||||
of fixtures, add the following to your application.rb file:
|
||||
Generators for factories will automatically substitute fixture (and maybe any other
|
||||
`fixture_replacement` you set). If you want disable this feature, add the
|
||||
following to your application.rb file:
|
||||
|
||||
config.generators do |g|
|
||||
g.fixture_replacement :factory_girl
|
||||
g.factory_girl false
|
||||
end
|
||||
|
||||
Default factories directory is `test/factories`, or `spec/factories` if
|
||||
`test_framework` generator is set to `:rspec`; change this behavior with:
|
||||
|
||||
config.generators do |g|
|
||||
g.factory_girl dir: 'custom/dir/for/factories'
|
||||
end
|
||||
|
||||
If you use `factory_girl` for fixture replacement, ensure that
|
||||
`factory_girl_rails` is available in the development group. If it's not, Rails
|
||||
will generate standard yml files instead of factory files.
|
||||
|
||||
`fixture_replacement :factory_girl` takes an option `:suffix => 'some_suffix'`
|
||||
`factory_girl` takes an option `suffix: 'some_suffix'`
|
||||
to generate factories as "modelname_some_suffix.rb"
|
||||
|
||||
More Information
|
||||
|
|
Loading…
Reference in a new issue