On 1/18/07, jenny lawrence <jenny at likemindedgroup.com>
wrote:>
>
>
>
> Hi
>
>
>
> I''m following the tutorial from the website.
>
>
>
> I''ve got to the end, but I''ve been getting this failure:
>
>
>
> ''A stack with one item should return top when you send it top
FAILED
>
> "one item" should equal "one item"
>
> ./stack_spec.rb:28:
>
> ./stack_spec.rb:27:in ''instance_eval''
>
>
>
> 3 specs 1 failure
>
>
>
> I do not understand this. Surely "one item" does equal "one
item". I''m a
> beginner and I''m just trying to copy exactly what it says on the
tin. What
> is going on?
Sorry Jenny - I haven''t updated the tutorial since we made some
changes to rspec syntax.
The deal is that ruby evaluates actual.equal?(expected) using object
identity. Even though "one item" and "one item" look the
same, they
are actually different objects in ruby. Instead, you want to use
either:
@stack.top.should_eql "one item"
OR
@stack.top.should == "one item"
Check out http://rspec.rubyforge.org/documentation/expectations.html
for more information.
I''ll update the tutorial soon.
Cheers,
David>
>
>
> Can anyone help?
>
>
>
> Thanks
>
>
>
> Jason
>
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>