我正在尝试在Rails 3中安装Factory Girl,但是当我运行rake cucumber
时出现以下错误:
james@james-laptop:~/rails-projs/simple-beach-63$ rake cucumber:wip (in /home/james/rails-projs/simple-beach-63) bundle exec /usr/bin/ruby1.8 -I "/usr/lib/ruby/gems/1.8/gems/cucumber-0.9.4/lib:lib"
"/usr/lib/ruby/gems/1.8/gems/cucumber-0.9.4/bin/cucumber" --profile wip Using the wip profile... uninitialized constant Factory (NameError) /usr/lib/ruby/gems/1.8/gems/rspec-expectations-2.1.0/lib/rspec/expectations/backward_compatibility.rb:6:in
const_missing' /usr/lib/ruby/gems/1.8/gems/factory_girl-1.3.3/lib/factory_girl/step_definitions.rb:25 /home/james/rails-projs/simple-beach-63/features/support/env.rb:8:in
require' /home/james/rails-projs/simple-beach-63/features/support/env.rb:8
您好,当您有时间时能否拉取并查看一下?
我在Gemfile中有以下内容:
gem 'factory_girl_rails'
gem 'factory_girl'
我在feature/support/env.rb中有这个内容。
require "factory_girl/step_definitions"
require "factory_girl"
require File.dirname(__FILE__) + "/factories"
然后我在features/support/factories.rb中定义了一个工厂。
我会非常感激任何帮助。