升级到 rails 5.2.0 后无法指定测试目录

Cannot specify directories for testing after upgrading to rails 5.2.0

我从 rails 5.1.1 升级到 rails 5.2.0。我的过程如下:

一切看起来都运行良好,除了我注意到我的测试套件中有一些奇怪的行为

知道 rails 5.1.1rails 5.2.0 之间发生了什么变化导致了这种行为吗?或者,也许我只是遗漏了什么?

根据 Rails Guides Testing Rails Applications: 2.7 The Rails Test Runner,它指出应该能够 运行 在每个目录的基础上进行测试:

You can also run an entire directory of tests by providing the path to the directory.

预期行为:

rails test => 运行 整个测试套件

rails test test/system => 运行系统目录下的所有测试

rails test test/models => 运行 只有模型目录中的测试

再现行为

我可以使用以下命令重现该行为:

rails new test_app         # create demo app
cd test_app                # cd into app
rails g scaffold user name # scaffold user
rake db:migrate            # migrate
rails test test/system/    # Expect to run system tests but does not (scaffold creates 4 system tests)

rails -T您可以看到可用的任务。这个问题的两个相关问题是

rails test          # Runs all tests in test folder except system ones
rails test:system   # Run system tests only

从中可以看出rails test不会运行系统测试。为此你需要 运行 rails test:system, iirc 正确你可以 运行 所有测试 rails test:system test