From 8021fb5b1cf5ec020e955f62a111c3c0d726cb3d Mon Sep 17 00:00:00 2001 From: Iazel Date: Tue, 19 Feb 2013 16:41:54 +0100 Subject: [PATCH] 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 --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1eb1dba..488d21d 100644 --- a/README.md +++ b/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