vim-rubytestでrspecのテストが走らなかったときの対応

vimから簡単にrubyのテストを実行出来るvim-rubytest

  • ファイル単位
  • テストケース単位

に対応しているからうれしい

かつ、

  • testunit
  • rspec
  • cucumber

にも対応。テストファーストな開発のお友達です!

rspecで動かなかった

rspecに対応していないわけではない。
自分の環境でrspecをたまたま動かせなかったのだと思う。

:!echo 'rspec spec/models/hoge_spec.rb' && rspec spec/models/hoge_spec.rb
rspec spec/models/hoge_spec.rb
zsh:1: command not found: rspec

けどできないでいるのはいやなので、ちょっとだけいじる。
rspecじゃなくて、specならいるので、

  • vim-rubytest/plugin/rubytest.vim
 if !exists("g:rubytest_cmd_spec")
-  let g:rubytest_cmd_spec = "rspec %p"
+  let g:rubytest_cmd_spec = "spec %p"
 endif
 if !exists("g:rubytest_cmd_example")
-  let g:rubytest_cmd_example = "rspec %p -l %c"
+  let g:rubytest_cmd_example = "spec %p -l %c"
 endif

という感じ。specのシンボリックリンクrspecにする、っていう方法でも良かったかな