对于我的生活,我无法让factory_girl在Rails3中工作.我创建了一个全新的应用程序.我的Gemfile:
gem "rspec" gem "rspec-rails" gem "factory_girl_rails"
application.rb中的生成器如下:
config.generators do |g| g.test_framework :rspec,:fixture => true,:views => false,:fixture_replacement => :factory_girl end
然后,使用生成器创建新模型:
> rails g model Addon name:string invoke active_record create db/migrate/20101223205918_create_addons.rb create app/models/addon.rb invoke rspec create spec/models/addon_spec.rb error factory_girl [not found]
我想念什么?我确实运行了捆绑安装…我试过四处寻找,但在factory_girl和rails3上找不到任何体面的文档.
解决方法
你需要的是
https://github.com/indirect/rails3-generators.
Rails 3 compatible generators for gems that don’t have them yet…
The Factory Girl generators have moved to 07001…