Search code examples
ruby-on-railsrubyrspecbundler

Why do I have to prepend 'bundle exec' to my command today?


Yesterday to run my tests I just needed rspec on the command line.

Today after doing a git pull and blah blah. I get this error

gems/bundler-1.6.2/lib/bundler/runtime.rb:34:in 'block in setup': You have already activated rspec-support 3.0.3, but your Gemfile requires rspec-support 3.0.0. Prepending 'bundle exec' to your command may solve this. (Gem::LoadError)

And yes bundle exec rspec works and runs my tests. What is going on here "under the hood"?


Solution

  • I suppose that in some point rspec-support gem was updated in your system. Maybe you did a gem update. But your app is using version 3.0.0 that is the reason for the message. You can update your bundle using bundle update. Usually the recommended way go avoid version collisions is to use bundle exec.

    References: