Skip to content

Instantly share code, notes, and snippets.

@agate
Created October 26, 2010 05:34
Show Gist options
  • Save agate/646381 to your computer and use it in GitHub Desktop.
Save agate/646381 to your computer and use it in GitHub Desktop.
1. rspec 2.0 doesn't have a "spec" command. Right now there only have "rspec" 2. not all users will install this plugin in their ~/.vim/plugin directory. so i changed the l:rubys && let l:xsl path
diff --git a/plugin/vim-rspec.vim b/plugin/vim-rspec.vim
index 88d9907..fe5d42c 100644
--- a/plugin/vim-rspec.vim
+++ b/plugin/vim-rspec.vim
@@ -12,8 +12,9 @@
let s:xsltproc_cmd = ""
let s:grep_cmd = ""
let s:hpricot_cmd = ""
-let s:xslt = 0
-let s:hpricot = 0
+let s:xslt = 0
+let s:hpricot = 0
+let s:install_dir = expand('<sfile>:p:h')
function! s:find_xslt()
return system("xsltproc --version | head -n1")
@@ -62,8 +63,9 @@ function! s:RunSpecMain(type)
let l:bufn = bufname("%")
" filters
- let l:xsl = expand("~/").".vim/plugin/vim-rspec.xsl"
- let l:rubys = expand("~/").".vim/plugin/vim-rspec.rb"
+ let l:xsl = s:install_dir."/vim-rspec.xsl"
+ let l:rubys = s:install_dir."/vim-rspec.rb"
+ call s:notice_msg(l:rubys)
" hpricot gets the priority
let l:type = s:hpricot ? "hpricot" : "xsltproc"
@@ -73,7 +75,7 @@ function! s:RunSpecMain(type)
if a:type=="file"
if match(l:bufn,'_spec.rb')>=0
call s:notice_msg("Running spec on the current file with ".l:type." ...")
- let l:spec = "spec -f h ".l:bufn
+ let l:spec = "rspec -f h ".l:bufn
else
call s:error_msg("Seems ".l:bufn." is not a *_spec.rb file")
return
@@ -105,7 +107,7 @@ function! s:RunSpecMain(type)
call s:error_msg("Could not find the ".l:dir." directory.")
return
end
- let l:spec = "spec -f h ".l:dir." -p **/*_spec.rb"
+ let l:spec = "rspec -f h ".l:dir." -p **/*_spec.rb"
end
" run the spec command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment