Ruby-1.9.2 removes ‘.’ from the $LOAD_PATH. There have been a couple of
issues reported against rspec-core-2 asking RSpec to add ‘.’ to
$LOAD_PATH for 1.9.2. My instinct is that this is the wrong way to go;
that Ruby is telling us to get used to typing “./” when we run command
line tools. What do you think?
I’ve updated my tests for 1.9.2, and although initially I thought it
was obnoxious, it’s a very sensible change. If . is in $:, then
your require line needs to change depending on where you run rspec
(or any other command invoking your Ruby scripts) from.
What’s much more sensible is to replace all usages of require '...'
that depend on . with a require_relative directive instead.
~ jf
John F.
Principal Consultant, Distilled Brilliance
Ruby-1.9.2 removes ‘.’ from the $LOAD_PATH. There have been a couple of issues reported against rspec-core-2 asking RSpec to add ‘.’ to $LOAD_PATH for 1.9.2. My instinct is that this is the wrong way to go; that Ruby is telling us to get used to typing “./” when we run command line tools. What do you think?
Upon further review (d’oh), it turns out there is a solution for this
already built into rspec-2.
Just add a .rspec file in the project root (or home directory for global
settings) and add a line that reads “-I.”. I’ll make sure this is
documented in the README.
Cheers,
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.