Require 'rspec' and Ruby 1.8.7

I am new to Ruby but not to Software Engineering.

I am trying to make some existing code work
on the Raring Ringtail version of Ubuntu.

The original code was written with Ruby 1.8
so I have removed Ruby 1.9.1 and installed 1.8.7
which solved some initial problems.

require ‘rspec’
causes the error.
in `require’: no such file to load – rspec (LoadError)
I have tried
sudo apt-get install ruby-rspec-core
and it makes no difference to the output.

Why can’t Ruby find rspec?
Do I have to apt-get an older version of rspec-core?
If so, how do I find out which one?
Or do I need to add something else to $RUBYLIB
Or something else?

Thanks for your help.

Does the file in question also require ‘rubygems’? If not, you could
either
add that line before the rspec one, or call the script with -rrubygems.

The latter was the one considered a best practice, I recall.

On Thu, Jun 20, 2013 at 4:00 PM, Mary-Anne Wolf
[email protected]wrote:

causes the error.
in `require’: no such file to load – rspec (LoadError)
I have tried
sudo apt-get install ruby-rspec-core
and it makes no difference to the output.

Looking at what ubuntu actually packages in the ruby-rspec-core package
(
http://packages.ubuntu.com/raring/all/ruby-rspec-core/filelist) that
package doesn’t include what you’d need to “require ‘rspec’”.

However, the ruby-rspec package (which depends on ruby-rspec-core and
others) does (http://packages.ubuntu.com/raring/all/ruby-rspec/filelist

specifically note: /usr/lib/ruby/vendor_ruby/rspec.rb).

Now, if it’s the case that you already have the ruby-rspec package
installed and it still doesn’t work, then you could help us help you by
giving us the output of: ruby -e ‘puts $:’

However, the ruby-rspec package (which depends on ruby-rspec-core and
others) does (http://packages.ubuntu.com/raring/all/ruby-rspec/filelist

Thank-you! apt-get ruby-rspec solves the problem.

Mary-Anne