I can run all tests in a single file with:
rake test TEST=path/to/test_file.rb
However, if I want to run just one test in that file, how would I do it?
I'm looking for similar functionality to:
rspec path/to/test_file.rb -l 25
I can run all tests in a single file with:
rake test TEST=path/to/test_file.rb
However, if I want to run just one test in that file, how would I do it?
I'm looking for similar functionality to:
rspec path/to/test_file.rb -l 25
Yup! Use Nick Quaranto's "m" gem. With it you can say:
If you are using MiniTest with Rails 5+ the best way to run all tests in a single file is:
And for a single test (e.g. on line 25):
See http://guides.rubyonrails.org/testing.html#the-rails-test-runner
I use
ruby /path/to/test -n /distinguishable word/
Edit:
-n
is a shorthand for--name
.distinguishable word
can be any string you put in the test description, I usually use some random word that I know won't be present in other tests' descriptions.The command should be:
Following will work
This can run by
rails test path/to/test_file.rb:25
will do it