[rspec-devel] [ rspec-Bugs-7429 ] should_equal fails, comparing 2 identical hash tables

noreply at rubyforge.org noreply at rubyforge.org
Sat Dec 23 23:18:35 EST 2006


Bugs item #7429, was opened at 2006-12-24 04:10
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=7429&group_id=797

Category: expectation module
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Steve Jorgensen (jorgens)
>Assigned to: David Chelimsky (dchelimsky)
Summary: should_equal fails, comparing 2 identical hash tables

Initial Comment:
If I try to use should_equal with hash tables, it always results in a failure, even when the hash tables have identical contents, and the Ruby == operator returns true for the same comparison.

Given a file, test.rb as follows...

context "foo" do

  specify "xxx" do
    {:v => ''}.should_equal :v => ''
  end

end

...

C:\1home>spec test.rb

F

1)
'foo xxx' FAILED
{:v=>""} should equal {:v=>""}
./test.rb:4:

Finished in 0.0 seconds

1 specification, 1 failure

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2006-12-24 04:18

Message:
You should use should_eql.

Please read http://rspec.rubyforge.org/documentation/expectations.html.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=7429&group_id=797


More information about the rspec-devel mailing list