假设您要测试test / controllers / static_pages_controller_test.rb
rails test test/controllers/static_pages_controller_test.rb
结果将是
(静态页面)$ rails test test / controllers / static_pages_controller_test.rb在进程2430中通过Spring预加载器运行运行选项:--seed 45024
运行:
..
完成0.900028s,2.2222次运行/秒,2.2222断言/秒。
2次运行,2次断言,0次失败,0次错误,0次跳过
您使用的rails测试方法运行所有单元,功能和集成测试。要仅运行单个测试,您可以使用如下的邀请测试
ruby -Itest test/controllers/static_pages_controller_test.rb
您还可以使用带有测试方法名称的-n开关从static_pages_controller_test运行特定的测试方法,如下所示。
ruby -Itest test/controllers/static_pages_controller_test.rb -n test_method_name
希望this link将帮助您获得更好的主意