thoughtbot / vim-rspec

Run Rspec specs from Vim
https://robots.thoughtbot.com
MIT License
657 stars 108 forks source link

Current RSpec file with no path #30

Closed BGuimberteau closed 11 years ago

BGuimberteau commented 11 years ago

After starting the series 'The Art of Vim' (awesome), I trying to use Vim for everything, in my Rails development.

I try this plugin, unfortunately when I run :

<Leader> t

instead of running the following command

rspec path / my_spec.rb

he launched

rspec my_rspec.rb

and so I have a problem can not load such file - spec_helper (LoadError)

jessieay commented 11 years ago

@BGuimberteau Hi Benjamin! Not sure if we were experiencing the same problem, but I just had the same error (LoadError) and was able to fix it, so I thought I'd share my fix.

I use the thoughtbot dotfiles to set everything up, so I use zsh, rbenv, and homebrew. I wasn't sure why my vim-rspec plugin wasn't working, but figured out that my $PATH within vim was not the same as my $PATH within zsh by running :! echo $PATH from within vim.

The solution, in the end, was found in a file at ~/.zshenv. My $PATH was being set by homebrew there and did not include my rbenv path. So I prepended that to the path in the file, opened a new vim tab, and the <LEADER> t command worked.

Here is what the contents of my ~/.zshenv file looks like now. Yours will obviously be a little different since your home directory is likely not named jessieayoung :)

export PATH=/usr/local/bin:/Users/jessieayoung/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin'

Let me know if that helps you!!

Jessie

gylaz commented 11 years ago

Sounds like this is an issue with pathing. Closing.

BGuimberteau commented 11 years ago

Hi,

Thanks for your answer @jessieay , but unfortunately my $PATH in vim is the same in my Terminal and the problem is still there.

If i can give you more informations for found a solution.

Thanks a lot.