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

Spring support #23

Open
vosechu opened this issue Feb 13, 2015 · 5 comments
Open

Spring support #23

vosechu opened this issue Feb 13, 2015 · 5 comments

Comments

@vosechu
Copy link

vosechu commented Feb 13, 2015

This is a placeholder as I work through figuring out how to add Spring support to rspec-autotest. If anyone has already figured it out though I'd love some advice.

@vosechu
Copy link
Author

vosechu commented Feb 13, 2015

Best I can find is to override the rspec command, but it's a garish hack. Is there a better way? Or is direnv the only good way to do this?

require 'autotest/restart'
require 'autotest/bundler'
require 'autotest/rails_rspec'

Autotest.add_hook :initialize do |at|
  # Allow rspec to use Spring
  RSpec::Core.instance_variable_set(:@path_to_executable, File.expand_path('../bin/rspec', __FILE__))
end

@seuros
Copy link
Member

seuros commented Feb 13, 2015

cc @myronmarston

@myronmarston
Copy link
Member

I've never used autotest or spring so I can't really speak to the best way to use autotest, spring and rspec together. Changing path_to_executable is definitely a hack that would be good to avoid. Rather than changing what RSpec considers the path to its executable, couldn't rspec-autotest provide a way to override what rspec executable it uses?

@vosechu
Copy link
Author

vosechu commented Feb 13, 2015

@myronmarston: No worries about not using autotest, we just wanted your opinion about whether there was a facility in RSpec that would allow us to change this dynamically. But I think we can do it on the autotest side.

I think we could fix that part of autotest. @seuros, do you think it would be reasonable to check for the existence of bin/rspec? Or is that too rails and spring specific?

@vosechu
Copy link
Author

vosechu commented Feb 14, 2015

I'm looking at a quick little conditional around https://github.com/rspec/rspec-autotest/blob/master/lib/rspec/autotest.rb#L45

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

3 participants