[rspec-users] Problems running RSpec 2 with autotest/autospec

David Chelimsky dchelimsky at gmail.com
Fri Dec 10 07:56:57 EST 2010


On Dec 10, 2010, at 1:18 AM, Michelle Pace 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:

1) 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.

2)
$ 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



> 
> http://michellepace.com/pics/autospec-problem.jpg
> 
> Again, any suggestions on how to get this working would really be
> appreciated.
> 
> Michelle
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Cheers,
David





More information about the rspec-users mailing list