I’m working through the “Ruby on Rails 3 Tutorial: Learn Rails by Example” by Michael Hartl (2011) and I’ve run into a conflict with rspec. Now when I try to run rspec I get:
rspec spec/
/home/bill44077/.rvm/gems/ruby-1.9.2-p136@global/gems/bundler-1.0.7/lib/bundler/runtime.rb:27:in `block in setup': You have already activated rspec-core 2.5.1, but your Gemfile requires rspec-core 2.4.0. Consider using bundle exec. (Gem::LoadError)
I looked in my Gemfile and I don’t see a revision requirement for rspec. I tried
gem uninstall rspec-rails
bundle install
but that didn’t seem to help. If I run
bundle exec rspec spec/
that works fine but I really want to run autotest as I was before so I need to get rspec working again as it was.
Any ideas what I need to do to solve this version problem?
thanks!!
Bill
This is because even though you did not specify a version of rspec in your gemfile, in your Gemfile.lock it will have stored the version (2.4.0 it looks like in this case).
Then, when you ran the command
rspecit was trying to use a newer version than the locked one. Runningbundle update rspecwill have updated the ‘locked’ version in Gemfile.lock, which, as you found, will sort it all out.