Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for both bin/rspec and rspec command? #65

Closed
thewatts opened this issue Sep 10, 2014 · 7 comments
Closed

Support for both bin/rspec and rspec command? #65

thewatts opened this issue Sep 10, 2014 · 7 comments

Comments

@thewatts
Copy link

Currently in my Rails projects I use Spring for quick loading. Which, with the custom setting, let g:rspec_command, that makes it easy.

Ex: let g:rspec_command = '!bundle exec bin/rspec {spec}'

However, some of my projects don't use Rails or Spring, which - in that case I need to jump back into my .vimrc.

Is there a way to set things up so that I can have the best of both worlds?


Side note: This plugin has changed my workflow completely (for the far better) - thank you for your hard work!

@gylaz
Copy link
Contributor

gylaz commented Sep 10, 2014

You could add ./bin to your PATH. Here's how Tim Pope suggests doing it. Then for projects that have spring wrapped rspec in their bin/ directory, it will use that. Otherwise, it'll find the next available rspec in your PATH.

@thewatts
Copy link
Author

@gylaz --- thanks for the quick response! I'll git it a shot!

@thewatts
Copy link
Author

hey @gylaz, just used Tim Pope's suggestion - and pulled the code directly from #52, and while it works great in terminal, when I'm in vim and run the command - it's not picking up Spring.

My direct command in my vimrc now: let g:rspec_command = '!bundle exec rspec {spec}'

Am I missing something?

@thewatts thewatts reopened this Sep 10, 2014
@jferris
Copy link
Contributor

jferris commented Sep 10, 2014

If you have rspec on your PATH as a binstub, you want just rspec and not bundle exec rspec. Using bundle exec will force it to find the binary from the rspec-core gem and not from Spring.

@gylaz
Copy link
Contributor

gylaz commented Sep 12, 2014

Going to close this. @thewatts feel free to re-open if you're still having issues.

@gylaz gylaz closed this as completed Sep 12, 2014
@mecampbellsoup
Copy link

So to be clear, the "best of both worlds" @thewatts requested can be had by let g:rspec_command = 'rspec {spec}' and adding ./bin to one's PATH - correct?

@jondkinney
Copy link

@mecampbellsoup from my testing just now, that is correct. Though I'm using RVM (I'm pretty sure @tpope is not), and I needed to do this to get my bin dir in the front of my path:

  1. brew install direnv

  2. Add eval $(direnv hook $0) to the end of my ~/.zshrc file

  3. Create a .envrc file in the root of my project with the following content:

    PATH_add bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants