guard / guard-rspec

Guard::RSpec automatically run your specs (much like autotest)

Home Page:https://rubygems.org/gems/guard-rspec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Guard seems to load non-bundled RSpec version

vrinek opened this issue · comments

I have rspec-core v2.14.7 bundled for my project and I have rspec-core v2.14.8 in my system gems. Bundler is complaining that the system rspec-core has been activated instead of the bundled one (see second gist).

bundle exec rspec spec/some_file_spec.rb works fine.

Not really sure if this is a bug with guard, guard-rspec, bundler or even rspec.

@vrinek Are you running guard with bundle exec guard?
ED: Sorry, I'm seeing it in the gist.

@907th yes, I have tried both with and without bundle exec and the result is the same complain about different versions of rspec-core.

I guess providing a showcase codebase able to reproduce the error would help, right?

@vrinek Yes, it would be helpful.

I took my original Rails app and started deleting files https://github.com/vrinek/guard-rspec-bug. In order to re-create the bug:

  • bundle install
  • gem install rspec-core -v '2.14.8'
  • bundle exec rspec spec/routing/attachments_routing_spec.rb this should work
  • bundle exec guard and press enter <-- this should fail

Please let me know when you try it.

Did you try the code I linked to? Was it helpful to reproduce the bug?

@vrinek Sorry. I didn't looked at it yet ( It were very busy weeks for me.

I'm seeing this with other guard-rspec dependencies as well. Despite calling bundle exec guard, when running rspec with it, it freaks out if there are versions different from what's currently activated by bundler on my system:

10:16:11 - INFO - Running all specs
WARN: Unresolved specs during Gem::Specification.reset:
      listen (~> 2.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
WARN: Unresolved specs during Gem::Specification.reset:
      rb-inotify (>= 0.9)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.

When listen had a lower bundled version than was available on the system, it would raise an error saying to prefix the command with bundle exec. Updating the bundle the use the latest version on the system fixed the error, but not the warnings.

I have several other guard plugins installed, and all of those seem to work fine without errors and warnings. Only when running with rspec does it seem to have a problem.

@shekibobo on which version of ruby and rubygems are you?

Have you try with guard :rspec, cmd: 'bundle exec rspec' do

@thibaudgg Changing the command does eliminate the warnings, thanks!

@thibaudgg this fixed my issues as well. Kudos!

Should I close this issue then?

Since guard warns you if you're not using bundler, shouldn't this either detect and warn or use bundler if it's available?