RSpec 和 Cucumber 测试损坏,不确定在哪里
好吧,我通常不问问题,因为我不喜欢看起来像个白痴,但是,现在我不再关心了。这让我发疯!
我在这里有一个仓库:
https://github.com/pgpkeys/journal_app/tree/ feature/model_rspecs_modification
我的问题要点位于: https://gist.github.com/977300< /a>
我创建了一个工厂(使用factory_girl),它存在于 [Dir[Rails.root] + "/factories/*.rb
中。我的 spec/support/factories.rb<但是,当我运行
bundle exec rake spec
时,我在显示、编辑、更新和删除 ActiveRecord::RecordNotFound: Couldn't find 时不断出现错误。没有 ID 的所有者
我有 let(:owner)。 { Factory(:owner) }
在我的 spec/controllers/owners_controller_spec.rb
文件中。它还需要 spec_helper.rb
(即使它已经由 rake spec 完成),它指向应该加载 factories 的
。spec/support/*.rb
/*.rb
OK, I don't usually ask questions because I don't like looking like an idiot, however, at this point I no longer care. This is driving me insane!
I have a repo here at:
https://github.com/pgpkeys/journal_app/tree/feature/model_rspecs_modification
My gist of the issue is at: https://gist.github.com/977300
I have a factory created (using factory_girl) which exists in [Dir[Rails.root] + "/factories/*.rb
. My spec/support/factories.rb
loads this factory. However when I run bundle exec rake spec
I'm getting constant errors with show,edit,update, and delete that ActiveRecord::RecordNotFound: Couldn't find Owner without an ID
. I have let(:owner)
in my
{ Factory(:owner) }spec/controllers/owners_controller_spec.rb
file . It also requires spec_helper.rb
(even though its already done by rake spec) which points to the spec/support/*.rb
which is supposed to load factories/*.rb
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题可能是由于“database_cleaner”gem 在每次测试运行时都会擦除数据库。因此,数据库可能是空的?
The problem might be because of 'database_cleaner' gem which wipes the database every time tests run. Because of this, the database could be empty?