Skip to content
Browse files

add RdbTestSingle command option that will pass line to rspec command

  • Loading branch information...
1 parent a83d9cb commit 97192e32bd74af5687c0f6fedbc29025c32a4416 Sumit Shah committed May 6, 2012
Showing with 12 additions and 4 deletions.
  1. +3 −2 autoload/ruby_debugger.vim
  2. +4 −0 doc/ruby_debugger.txt
  3. +1 −0 plugin/ruby_debugger.vim
  4. +1 −0 src/ruby_debugger/init.vim
  5. +3 −2 src/ruby_debugger/public.vim
View
5 autoload/ruby_debugger.vim
@@ -692,10 +692,11 @@ endfunction
" Debug current opened test
-function! RubyDebugger.run_test() dict
+function! RubyDebugger.run_test(...) dict
let file = s:get_filename()
if file =~ '_spec\.rb$'
- call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file)
+ let line = a:0 && a:0 > 0 && !empty(a:1) ? a:1 : " "
+ call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file . line)
elseif file =~ '\.feature$'
call g:RubyDebugger.start(g:ruby_debugger_cucumber_path . ' ' . file)
elseif file =~ '_test\.rb$'
View
4 doc/ruby_debugger.txt
@@ -233,6 +233,10 @@ For this, set some variables in your .vimrc. E.g.: >
let g:ruby_debugger_spec_path = 'c:\gembins\spec' " set Rspec path
let g:ruby_debugger_cucumber_path = 'c:\gembins\cucumber' " set Cucumber path
+A single rspec test can be invoked by RdbTestSingle which will invoke rspec
+and pass the current line to rspec via "-l" argument to rspec. For Cucumber
+and Test::Unit all tests/features are run.
+
==============================================================================
RUBY 1.9 AND RAILS 3 *ruby-debugger-ruby19*
View
1 plugin/ruby_debugger.vim
@@ -19,6 +19,7 @@ command! -nargs=* -complete=file Rdebugger call ruby_debugger#load_debugger() |
command! -nargs=0 RdbStop call g:RubyDebugger.stop()
command! -nargs=1 RdbCommand call g:RubyDebugger.send_command_wrapper(<q-args>)
command! -nargs=0 RdbTest call g:RubyDebugger.run_test()
+command! -nargs=0 RdbTestSingle call g:RubyDebugger.run_test(" -l " . line("."))
command! -nargs=1 RdbEval call g:RubyDebugger.eval(<q-args>)
command! -nargs=1 RdbCond call g:RubyDebugger.conditional_breakpoint(<q-args>)
command! -nargs=1 RdbCatch call g:RubyDebugger.catch_exception(<q-args>)
View
1 src/ruby_debugger/init.vim
@@ -19,6 +19,7 @@ command! -nargs=* -complete=file Rdebugger call ruby_debugger#load_debugger() |
command! -nargs=0 RdbStop call g:RubyDebugger.stop()
command! -nargs=1 RdbCommand call g:RubyDebugger.send_command_wrapper(<q-args>)
command! -nargs=0 RdbTest call g:RubyDebugger.run_test()
+command! -nargs=0 RdbTestSingle call g:RubyDebugger.run_test(" -l " . line("."))
command! -nargs=1 RdbEval call g:RubyDebugger.eval(<q-args>)
command! -nargs=1 RdbCond call g:RubyDebugger.conditional_breakpoint(<q-args>)
command! -nargs=1 RdbCatch call g:RubyDebugger.catch_exception(<q-args>)
View
5 src/ruby_debugger/public.vim
@@ -260,10 +260,11 @@ endfunction
" Debug current opened test
-function! RubyDebugger.run_test() dict
+function! RubyDebugger.run_test(...) dict
let file = s:get_filename()
if file =~ '_spec\.rb$'
- call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file)
+ let line = a:0 && a:0 > 0 && !empty(a:1) ? a:1 : " "
+ call g:RubyDebugger.start(g:ruby_debugger_spec_path . ' ' . file . line)
elseif file =~ '\.feature$'
call g:RubyDebugger.start(g:ruby_debugger_cucumber_path . ' ' . file)
elseif file =~ '_test\.rb$'

0 comments on commit 97192e3

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