[rspec-users] rspec tutorial - "one item" should equal "one item"

David Chelimsky dchelimsky at gmail.com
Mon Dec 4 15:44:31 EST 2006

On 12/4/06, philip reed <philipreedtech at gmail.com> wrote:
> Apologies in advance if this is a Ruby-ignorant question.
> I'm working my way through the tutorial, and I made it to page 3,
> where I found a discrepancy.   In the 5th code block, preceded by
> "What's the simplest thing we can add to meet all of the current
> expectations?" I add the trivial return value to the top method as
> shown.   Now the stack is supposed to be returning "one item", but
> instead of passing the test as show in the tutorial, I get:
> 1)
> 'A stack with one item should return top when you send it 'top'' FAILED
> "one item" should equal "one item"
> ./stack_spec.rb:28:
> Finished in 0.0 seconds
> 3 specifications, 1 failure
> I would guess this is some sort of issue about equivalence of two
> instances versus having the same instance in Ruby.   Am I right?

Yep - the tutorial is outdated. Use should == instead. I'll update the tutorial.


> At
> any rate, is this behavior that's changed since the tutorial, or do I
> need to look harder in my tutorial code to make sure I didn't
> implement anything wrong?
> I can post a snapshot of the code if needed.
> Regards,
> Philip
> --
> Philip Reed, Web developer
> http://philipreedtech.com
> Web.  Made simple.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list