如何以minitest运行单个测试文件?

时间:2018-01-06 22:39:47

标签: unit-testing controller ruby-on-rails-5 minitest

我正在使用带有minitest的Rails 5并尝试运行单个测试文件。该文件是" test / controllers / issues_controller_test.rb"所以我以为我可以跑

rake test TEST=test/controllers/issues_controller_test.rb

但是当我尝试这样做时我收到错误...

localhost:myproject davea$ rake test TEST=test/controllers/issues_controller_test.rb
Run options: --seed 24216

# Running:

E

Error:
IssuesControllerTest#test_logged_in_should_get_issues_page:
NoMethodError: undefined method `users' for #<IssuesControllerTest:0x007fac86c864c0>
    test/controllers/issues_controller_test.rb:7:in `block in <class:IssuesControllerTest>'


bin/rails test test/controllers/issues_controller_test.rb:6



Finished in 0.006048s, 165.3439 runs/s, 0.0000 assertions/s.

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips

请注意,当我运行&#34; rails test&#34;我在这个文件上没有任何错误,所以我的问题是,如何使用minitest运行单个测试文件?

1 个答案:

答案 0 :(得分:0)

bin/rails test test/controllers/issues_controller_test.rb