On Dec 10, 2010, at 1:18 AM, Michelle P. wrote:
Thanks (again) Dave for your reply and the time you’ve taken.
However I think I must be really bad at explaining myself… so I’ve
drawn a picture for you which to show my problem. [One of the
requirements in the book is that I have to have ZenTest installed.]
You’re explaining yourself just fine. The problem is that you’re
listening 1/2 to the book and 1/2 to me, but you need to just listen to
me right now
The problem is as follows:
- the book uses ruby-1.8
- you are using ruby-1.9
- ruby-1.8 includes “.” on the $LOAD_PATH
- ruby-1.9 does not include “.” on the $LOAD_PATH
- ZenTest-4.4.1 does not add “.” to the $LOAD_PATH
- these last two ^^ mean that if you’re using ruby-1.9, rspec-2, and
ZenTest-4.4.1, the autotest command that ships with ZenTest will not
find ‘./autotest/discover.rb’ and will not load the correct class
- per the error message you got when you ran autospec, autospec has been
removed from rspec-2, so you have to use the autotest command
Any of the following combinations will work:
- Run the following commands
$ gem uninstall ZenTest
$ gem uninstall autotest
$ gem install autotest -v 4.4.5
$ autotest
Again, use autotest, not autospec. autotest-4.4.5 is a standalone
autotest gem that does not require ZenTest. This will work using the
autotest/discover.rb file because autotest-4.4.5 adds “.” to the
$LOAD_PATH.
-
$ gem uninstall autotest
$ gem install ZenTest
At this point you have the book’s recommended setup, but the autotest
command will not see autotest/discover.rb. Your options are:
a) add “.” to the $LOAD_PATH yourself
$ ruby -I . -S autotest
The -I option tells ruby to add its argument (‘.’) to the command line.
The -S option tells ruby what script to run (autotest).
b) Use autotest’s --style option
$ autotest --style rspec2
This bypasses the search for autotest/discover.rb (so you can delete it
if you’re using this) and “just works.”
There are other options, but I don’t want to confuse you any further. I
really hope this clears things up.
Also, I’ve reported this issue to the ZenTest project, so there is some
chance that ZenTest-4.4.2 will add “.” to the $LOAD_PATH, at which point
the material in the book will work as written (except that the file is
“autotest/discover.rb”, not “autotest/.autotest/discover.rb”) with
ruby-1.9.
Good luck!
Cheers,
David
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users
Cheers,
David