我可以在一个文件中运行所有测试:
rake test TEST=path/to/test_file.rb
但是,如果我只想在该文件中运行一个测试,我该怎么做呢?
我正在寻找类似的功能:
rspec path/to/test_file.rb -l 25
我可以在一个文件中运行所有测试:
rake test TEST=path/to/test_file.rb
但是,如果我只想在该文件中运行一个测试,我该怎么做呢?
我正在寻找类似的功能:
rspec path/to/test_file.rb -l 25
当前回答
你有没有试过:
ruby path/to/test_file.rb --name test_method_name
其他回答
我正在寻找类似于rspec path/to/file的功能。Rb -l 25
用尼克·夸兰托的"m"宝石,你可以说:
m spec/my_spec.rb:25
如果你在minitest中使用Turn gem,请确保使用Turn.config.pattern选项,因为Turn minitest运行器不尊重arg中的——name选项。
不需要宝石: ruby - test test/lib/testRb——name /some_test/
来源:http://blog.arvidandersson.se/2012/03/28/minimalicous-testing-in-ruby-1-9
你有没有试过:
ruby path/to/test_file.rb --name test_method_name
你可以用它来运行一个文件:
rake test TEST=test/path/to/file.rb
我也用过
ruby -I"lib:test" test/path/to/file.rb
为了更好的显示。