2006/11/21

RSpec on Rails

I have played with RSpec before and I liked it. But yesterday I was trying to bring RSpec on
Rails. The installation process was meant to be quiet easy:

1. Installing rspec gem
2. Installing the corresponding version of the plugin
3. Generating rspec and moving with rocket speed ahead.

This 3 Steps where easy. Writing the first spec for my model as well. Running rake spec
however turned out to be not as easy as expected. Instead I got:



c:/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.4.2/test/test_help.rb:5:
superclass mismatch for class TestSession (TypeError) from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'

Superclass mismatch. Ouchh! Errors like that are usually showing up when running migrations
and having multiple definitions of the same class (A second definition in the migration file for
example). But TestSession was definitely not a class of my domain model.

Analyzing the listed source didn't bring me further either. Then my next assumption brought my
to realize that I had to install the dependency ZenTest for successfully installing the gem
rspec (0.7.2). I knew I had the correct version of the plugin and the gem. So I rolled my ZenTest

gem back from version 3.4.2 to 3.4.1:

c:\>gem install zentest -v 3.4.1
Then again running 'rake spec' and guess what:

.....

Finished in 0.16 seconds

1 specifications, 1 failures


And this was exactly the output I was looking for since I do TDD and a failing test/spec is the start point for my implementation.


Version issues. I hopefully will not be troubled by these the next...couple of... ...years. ;)