Skip to content
Browse files

Set <leader>t to run unit tests

  • Loading branch information...
1 parent 447e938 commit 5e06296728107e23c46b7a99873ad672a3530d71 @baphled committed Aug 20, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 ruby.vim
View
12 ruby.vim
@@ -19,12 +19,12 @@ function! RunTests(filename)
exec ":!bundle exec cucumber " . a:filename
elseif match(a:filename, '_spec\.js\.coffee$') != -1
exec ":!bundle exec jasmine-headless-webkit " . a:filename
+ elseif match(a:filename, '_test\.rb') != -1
+ "If there is a colon in the file name we need to find the test method
+ "name and use that to call the specific test
+ exec ":!bundle exec ruby -I\"lib:test\" " . a:filename
else
- if filereadable("script/test")
- exec ":!script/test " . a:filename
- else
- exec ":!bundle exec rspec " . a:filename
- end
+ exec ":!bundle exec rspec " . a:filename
end
endfunction
@@ -41,7 +41,7 @@ function! RunTestFile(...)
endif
" Run the tests for the previously-marked file.
- let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_spec.js.coffee\)$') != -1
+ let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_test.rb\|_spec.js.coffee\)$') != -1
if in_test_file
call SetTestFile()
elseif !exists("t:grb_test_file")

0 comments on commit 5e06296

Please sign in to comment.
Something went wrong with that request. Please try again.