Skip to content

Commit

Permalink
Set <leader>t to run unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed Aug 20, 2012
1 parent 447e938 commit 5e06296
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ruby.vim
Expand Up @@ -19,12 +19,12 @@ function! RunTests(filename)
exec ":!bundle exec cucumber " . a:filename exec ":!bundle exec cucumber " . a:filename
elseif match(a:filename, '_spec\.js\.coffee$') != -1 elseif match(a:filename, '_spec\.js\.coffee$') != -1
exec ":!bundle exec jasmine-headless-webkit " . a:filename 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 else
if filereadable("script/test") exec ":!bundle exec rspec " . a:filename
exec ":!script/test " . a:filename
else
exec ":!bundle exec rspec " . a:filename
end
end end
endfunction endfunction


Expand All @@ -41,7 +41,7 @@ function! RunTestFile(...)
endif endif


" Run the tests for the previously-marked file. " 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 if in_test_file
call SetTestFile() call SetTestFile()
elseif !exists("t:grb_test_file") elseif !exists("t:grb_test_file")
Expand Down

0 comments on commit 5e06296

Please sign in to comment.