如何在 MiniTest 中 运行 只测试控制器?

How to run only controller tests in MiniTest?

运行 仅在 minitest 中进行控制器测试的 rake 命令是什么? rake test:controller 不成功。

尝试将其设为复数。这是典型的命令:

rake test:controllers

http://guides.rubyonrails.org/testing.html#rake-tasks-for-running-your-tests

第 6 节介绍了用于测试的 rake 命令。

必须是复数 rake test:controllers,因为您要 运行 全部。

请查看 http://guides.rubyonrails.org/testing.html#rake-tasks-for-running-your-tests 以获得更多 rake 命令。

如果你想运行一个特定的文件,那么使用TEST参数:

rake test TEST=test/controllers/application_controller_test.rb

作为更新:

rails test path/to/test/file.rb 已成为我的 go-to 解决方案。
rails test path/to/test/file.rb:123 还允许您通过行号选择测试。