Vim, RubyTest, & RSpec

If you use the Vim editor (or one of it’s counterparts like gVim), use the RubyTest Vim Plugin, and you use RSpec for some of your testing then you might run into a problem that I was experiencing where it gives you the error:

:!echo 'spec -f specdoc spec/greeter_spec.rb -l 8' && spec -f specdoc spec/greeter_spec.rb -l 8
spec -f specdoc spec/greeter_spec.rb -l 8
/bin/bash: spec: command not found

shell returned 127

Well, since I use RSpec 2.x (since I’m just now starting to use RSpec), the above error is quite annoying because the ‘spec’ command isn’t really used anymore (at least from what I can find on the internet).  So to get the RubyTest plugin to work with RSpec (and the ‘rspec’ command) you have to make a small change the plugin as marked below via a diff.

--- rubytest.vim.old	2011-01-29 14:29:19.897897990 -0600
+++ rubytest.vim	2011-01-29 14:30:16.487584334 -0600
@@ -21,10 +21,10 @@
   let g:rubytest_cmd_testcase = "ruby %p -n '/%c/'"
 endif
 if !exists("g:rubytest_cmd_spec")
-  let g:rubytest_cmd_spec = "spec -f specdoc %p"
+  let g:rubytest_cmd_spec = "rspec -f d %p"
 endif
 if !exists("g:rubytest_cmd_example")
-  let g:rubytest_cmd_example = "spec -f specdoc %p -l %c"
+  let g:rubytest_cmd_example = "rspec -f d %p -l %c"
 endif
 if !exists("g:rubytest_cmd_feature")
   let g:rubytest_cmd_feature = "cucumber %p"
This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Comments are closed.