views:

158

answers:

2

I have been following an RSpec tutorial on one of my machines, in the hope of learning more about BDD and TDD. My setup was with Rails 2.2.2 and Rspec 1.1.12

Tonight I decided to continue on my primary machine and moved my code from my portable to my desktop. Not having RSpec, i installed the gem . . .

sudo gem install rspec
sudo gem install rspec-rails

Strife and Calumny! The new version of Rspec installed! 1.2.0! And now my tests are failing all over the place! While I fully intend to follow up and learn the most up to date version, I would really like to complete what's left of the tutorial without having to start over. I am wondering. Is there a way to install and specify that I would like to run my code against the previous Rspec, 1.2.12?

+3  A: 

You could uninstall and reinstall with VERSION specified. Explained here.

srboisvert
In my experience, this is about the only way to do it ... rspec has some dependencies that will turn the latest version "active" or some such thing. Not 100% on the internals. But uninstall will fix.
Toby Hede
+2  A: 

If you want to have more than one version on your computer, for if maybe you should have a 2.2 rails app and a 2.3 rails app then in your environment.rb file specify:

config.gem, 'rspec', :lib => 'spec', :version => '1.1.12'

and your application will use that gem spec and the rspec-rails gem that goes with it. This will enable you to use the appropriate gem for each appliction.

railsninja