This is a Minitest adaptation of Rspec.vim from thoughtbot. to run specific tests from Vim.
NOTE: 2016-02-21: I think minitest-line makes this plugin obsolete.
Recommended installation with vundle:
Bundle 'spellman/vim-minitest'
Running all tests is achieved via running /test/test_helper.rb, which should require all tests. I used the following code in test_helper.rb from the CrashRuby blog. Note this assumes that vim's working directory is the project root.
require "minitest/autorun"
require "bundler/setup"
if __FILE__ == $0
$LOAD_PATH.unshift "lib", "test"
Dir.glob("./test/**/test_*.rb") { |f| require f }
end
" Minitest.vim mappings
nmap <Leader>t <Plug>vim-minitest#RunCurrentTestFile
nmap <Leader>s <Plug>vim-minitest#RunNearestTest
nmap <Leader>l <Plug>vim-minitest#RunLastTest
nmap <Leader>a <Plug>vim-minitest#RunAllTests
Overwrite g:minitest_command
variable to execute a custom command.
Example:
let g:minitest_command = "!ruby -Itest {test}"