没有这样的工厂:用户(ArgumentError)但是......它已定义。并且使用 find_definitions() 只是查找重复项...=\
因此,我最近转向了捆绑程序,但在让一切重新正常工作时遇到了问题。
当我运行bundle exec rake test:units时,我收到此错误:
....../gems/factory_girl-1.2.4/lib/factory_girl/factory.rb:327:in `factory_by_name': No such factory: user (ArgumentError)
并且,我在另一篇堆栈溢出帖子中看到有人通过添加但是解决了问题
FactoryGirl.find_definitions
,错误说我有重复的定义(我没有,原因搜索) 我什至尝试只拥有一个工厂文件。但错误仍然存在。
test_helper 顶部:
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require "bundler/setup"
Bundler.require(:test)
gem 文件中的测试组
group :test do
gem "cucumber", "~>0.10.3"
gem "cucumber-rails", "0.3.2"
gem "launchy"
gem "hpricot"
gem "gherkin", "~>2.4.0"
gem "capybara", "0.4.1.2"
gem "rspec", "1.3.2"
gem "rspec-rails", "1.3.2"
gem "rspec-core"
gem "rspec-expectations"
gem "webrat", "0.7.0"
gem "database_cleaner"
gem "factory_girl", "1.2.4"
gem "shoulda"
gem "awesome_print"
gem "cobravsmongoose"
end
So, I recently moved to bundler, and I'm having issues getting everything working again.
when I run bundle exec rake test:units, I get this error:
....../gems/factory_girl-1.2.4/lib/factory_girl/factory.rb:327:in `factory_by_name': No such factory: user (ArgumentError)
and, I saw in a another stack overflow post that someone fixed the problem by adding
FactoryGirl.find_definitions
but, that errors in saying that I have duplicate definitions (which I don't, cause search)
I even tried having only one factories file. but the error continued.
top of test_helper:
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require "bundler/setup"
Bundler.require(:test)
test group in gem file
group :test do
gem "cucumber", "~>0.10.3"
gem "cucumber-rails", "0.3.2"
gem "launchy"
gem "hpricot"
gem "gherkin", "~>2.4.0"
gem "capybara", "0.4.1.2"
gem "rspec", "1.3.2"
gem "rspec-rails", "1.3.2"
gem "rspec-core"
gem "rspec-expectations"
gem "webrat", "0.7.0"
gem "database_cleaner"
gem "factory_girl", "1.2.4"
gem "shoulda"
gem "awesome_print"
gem "cobravsmongoose"
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论