Consider using bundle exec? How do I resolve this error "You have already activated rspec-core..."

I’m pretty newb… when I try to run my rspec tests I get the following error:

You have already activated rspec-core 2.3.1, but your Gemfile requires rspec-core 2.1.0. Consider using bundle exec.

At one point for another app was working with I did have rspec-core 2.31 defined, but in this app I have my Gemfile as:

source ‘http://rubygems.org

gem ‘rails’, ‘3.0.3’ gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

group :development do

gem ‘rspec-rails’, ‘2.1.0’ end

group :test do gem ‘rspec’, ‘2.1.0’ gem ‘webrat’, ‘0.7.1’ end

and I had done bundle install previously which shows:

Using abstract (1.0.0) Using activesupport (3.0.3) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.3) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.6) Using tzinfo (0.3.23) Using actionpack (3.0.3) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.12) Using actionmailer (3.0.3) Using arel (2.0.6) Using activerecord (3.0.3)

Using activeresource (3.0.3) Using bundler (1.0.7) Using diff-lcs (1.1.2) Using nokogiri (1.4.4) Using thor (0.14.6) Using railties (3.0.3) Using rails (3.0.3) Using rspec-core (2.1.0) Using rspec-expectations (2.1.0)

Using rspec-mocks (2.1.0) Using rspec (2.1.0) Using rspec-rails (2.1.0) Using sqlite3-ruby (1.2.5) Using webrat (0.7.1)

The only thing on google I found was related to http://stackoverflow.com/questions/3695504/rails3-rspec-issue and it’s implying I need to manually delete some gems? This is confusing. I am also using rvm if that matters. I ran into all of this going through the ruby on rails tutorial http://railstutorial.org/chapters/filling-in-the-layout#book_menu chapter 3.

You have already activated rspec-core 2.3.1, but your Gemfile requires rspec-core 2.1.0. Consider using bundle exec.

Did you consider using bundle exec?

Precede your command with "bundle exec", i.e. "bundle exec rspec spec"

I had tried typing “bundle exec” and received errors, didn’t realize it it was “bundle exec rspec spec” I’ll have to read up what that does.

The solution was to read further along in the tutorial… and it mentions this to fix issues…

$ rvm gemset delete rails3tutorial $ rvm --create use 1.9.2@rails3tutorial $ rvm --default 1.9.2@rails3tutorial

$ gem install rails -v 3.0.3 $ bundle install

I guess it’s a good practice to setup a gemset specific for each project. I hadn’t done that previously (which yes I know the tutorial does mention to do earlier.)