PaperKraftMike
PaperKraftMike

Reputation: 99

RSPEC not working with RVM

So I just installed rvm, and got it working all nice and pretty. I was previously running ruby 1.8.7 and it was preventing a couple of my rspec tests from passing.

Now that I have rvm installed and working properly my rspec is not working. I know I have the rspec gem installed. But now when run the rakecommand I get this error when running ruby 1.9.2:

(in /Users/TheRedFool/learn_ruby-master)
rake aborted!
Could not find rspec (~> 2) amongst [bundler-1.3.2, minitest-1.6.0, rake-10.0.3, rake-0.8.7, rdoc-2.5.8, rubygems-bundler-1.1.1, rvm-1.11.3.6]
/Users/TheRedFool/learn_ruby-master/Rakefile:2:in `<top (required)>'
/Users/TheRedFool/.rvm/gems/ruby-1.9.2-p320@global/bin/ruby_noexec_wrapper:14:in `eval'
/Users/TheRedFool/.rvm/gems/ruby-1.9.2-p320@global/bin/ruby_noexec_wrapper:14:in `<main>'

And when using the rake command while running ruby 2.0.0 I get this error:

(in /Users/TheRedFool/learn_ruby-master)
rake aborted!
Could not find 'rspec' (~> 2) among 8 total gem(s)
/Users/TheRedFool/learn_ruby-master/Rakefile:2:in `<top (required)>'

This is driving me a little bonkers, so thank you in advance for any help.

Upvotes: 0

Views: 1999

Answers (1)

Leo Correa
Leo Correa

Reputation: 19839

Whenever you use rvm and install a new ruby version you must install a new set of gems either in a gemset or the default gemset. They don't get passed along versions, specially ones that weren't installed with rvm. You can check to see if you have the gem installed by running

gem list | grep rspec

Also, note that if your project has a Gemfile you can run bundle install to install to make sure all your gems are installed where they belong.

Upvotes: 3

Related Questions