It's difficult to run individual tests with Minitest, because it doesn't accept line numbers (like RSpec), it only accepts regexes and test names. Test.vim, however, polyfills this limitation by parsing the file to determine which test is the closest to your cursor, and constructs a regex.
All of the Minitest syntaxes are supported:
Classic unit syntax
class MathTest < Minitest::Test def test_addition assert_equal 2, 1 + 1 end end
:TestNearest
=> ruby -I test math_test.rb --name '/MathTest#test_addition/'
Rails' unit syntax
class MathTest < ActiveSupport::TestCase test "addition" do assert_equal 2, 1 + 1 end end
:TestNearest
=> ruby -I test math_test.rb --name '/MathTest#test_addition/'
Classic spec syntax
describe "Math" do it "adds numbers" do (1 + 1).must_equal 2 end end
:TestNearest
=> ruby -I test math_test.rb --name '/Math#test_\d+_adds numbers/'
Explicit spec syntax
class MathTest < Minitest::Spec it "adds numbers" do (1 + 1).must_equal 2 end end
:TestNearest
=> ruby -I test math_test.rb --name '/MathTest#test_\d+_adds numbers/'
Test.vim's Minitest wrapper chooses the executable using the following logic:
Rake::TestTask
defined, or you're using Rails, then.zeus.sock
is detected run zeus rake test
,bin/rake
is present, run bin/rake
,Gemfile
is present, run bundle exec rake
,rake
.Gemfile
is present, run bundle exec ruby -I test
,ruby -I test
.Whether or not you're using Rake for running your Minitest suite, Test.vim goes to great lengths to provide the same experience.
When using Rake, it's really difficult to pass test options. Luckily, test.vim has solved that problem for you:
:TestFile --seed 1234
=> rake test TEST="your_file_test.rb" TESTOPTS="--seed=1234"
ruby -I test
improvements
When not using Rake, it's really difficult to run the whole test suite. Test.vim has got your back here as well:
:TestSuite
=> ruby -I test -e 'Dir["./test/**/*_test.rb"].each &method(:require)'
If you want test.vim to use M for running tests, you can set the executable:
let g:test#ruby#minitest#executable = 'm'
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4