RSpec Tutorial Out of Sync

Just setting up my iBook for the next two days of tutorials at Software Development West 2006 and I ran across a familiar problem. Dave Astels is running the hands on tutorial on Behavior-Driven Development and using RSpec which he wrote in Ruby.

My notes say:

Attendees should be able to run the RSpec examples successfully before the tutorial.

So I’ve downloaded RSpec 0.4 and tried to run through the tutorial. The very first example is write the following expectation:

1.should_equal 1

And I get the following error:

undefined method `should_equal' for 1:Fixnum

After much experimentation I tried:

1.should.equal 1

And I get:

Finished in 0.037051 seconds
0 specifications, 0 failures

So I wrapped it up into a little class:

require 'spec'
class ExpectationsTest < Spec::Context
  def expect_one
    1.should.equal 1

Then I happily get:

Finished in 0.017554 seconds
1 specifications, 0 failures

I’m guessing the the tutorial hasn’t been updated to the current release of the software. Another minor thing is that when you do the install and confirm that RSpec works by issuing the


command. You’re suppose to see:

Finished in 0.002726 seconds
0 specifications, 0 expectations, 0 failures

Instead I see:

Finished in 0.021852 seconds
0 specifications, 0 failures

Somehow the expectations total is missing which makes me wonder if I’ve done something wrong. Anyway I think I have everything and I should get a much better feel for it after the tutorial.

Update, turns out that Dave did mention the should_equal changing to should.equal in this blog entry. Now the tutorial just needs to be updated.