我尝试运行 RSpec 测试:
rspec comments.rb
但不断收到相同的错误(见标题)。在有人问之前我已经添加了require factory_girl
到spec_helper.rb。
的内容spec/factories/comments.rb
文件是:
FactoryGirl.define do
factory :comment do
comment "MyString"
task_id 1
end
end
这是 gemfile 的测试组,其中包含了factory_girl_rails:
source 'http://rubygems.org'
...
group :development, :test do
gem 'debugger'
gem 'factory_girl_rails'
gem 'rspec-rails'
end
...
您只需在 spec_helper.rb 文件中添加以下内容
require 'factory_girl_rails'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)