【问题标题】:Cannot test my model tests无法测试我的模型测试
【发布时间】:2015-07-29 17:16:56
【问题描述】:

我在文件夹中有测试:

 test/models/person/helper/age_calculator_test.rb

这些测试应该失败,因为:

  assert_equal false, true

我运行时它们确实失败了:

bundle exec m test/models/person/helper/age_calculator_test.rb

但是当我跑步时:

bundle exec m test/models

这些测试没有运行!我做错了什么? 如何在一个命令中使用 Bundler 测试我的所有 Model-Test?谢谢!!

【问题讨论】:

  • 当它们不运行时会发生什么?你收到某种信息吗?错误信息?请分享!
  • 否 看来这个测试根本就没有被访问!

标签: ruby ruby-on-rails-4 testing rake bundler


【解决方案1】:

您似乎使用了Metal test runner。我在其支持路径测试的文档中看不到任何地方,例如test/models。它的主要特点是按行号运行测试。

如果您想执行所有模型测试,您可以使用 Rails 的

rake test:models

去做。有关更多选项,请参阅Rake Tasks for Running your Tests 上的 RoR 指南。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-19
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    相关资源
    最近更新 更多