I am trying to use FactoryGirl instead of default fixtures in edge Rails 3. I used
http://github.com/pjb3/rails3-generators
and tried to do the replacement as adviced in
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
this way (config/application.rb)
config.generators do |g|
g.orm :active_record
g.template_engine :erb
g.test_framework :test_un开发者_如何学JAVAit, :fixture => true
g.fixture_replacement "factory_girl", :dir => "test/factories"
end
looks good, isn't it? But it does not work ... any ideas?
It seems that the proper way to do it (at least for now :)) is slightly different:
config.generators do |g|
g.orm :active_record
g.template_engine :erb
g.test_framework :test_unit, :fixture_replacement => :factory_girl
end
For Rails 3.1.rc1 you need "gem 'rails3-generators'" in your Gemfile for the factory_girl fixture replacement to work.
精彩评论