[rspec-devel] [ rspec-Bugs-7429 ] should_equal fails, comparing 2 identical hash tables
noreply at rubyforge.org
noreply at rubyforge.org
Sun Dec 24 00:11:56 EST 2006
Bugs item #7429, was opened at 2006-12-23 20: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: Steve Jorgensen (jorgens)
Date: 2006-12-23 21:11
Message:
After reading the documentation you pointed me to, your
answer makes complete sense. However, when I change the
should_equal call to a should_eql call, it still fails.
F
1)
'foo xxx' FAILED
{:v=>""} should eql {:v=>""}
./test.rb:4:
Finished in 0.0 seconds
1 specification, 1 failure
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2006-12-23 20: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