[rspec-users] eql not matching identical hashes unless they actually are the same object

Leandro Pedroni ilpoldo at gmail.com
Thu Jan 8 11:26:50 EST 2009


rspec 1.1.11 and it's rails sidekick.

After writing a few specs for an object I created that inherits form
an Hash I noticed that eql wasn't matching hashes that where actually
matching (I'm pretty sure it worked fine before):

  {:foo => 0, :bar => 1}.should eql({:foo => 0, :bar => 1})
  # => expected {:foo=>0, :bar=>1}, got {:foo=>0, :bar=>1}
(using .eql?)

  h={:foo => 0, :bar => 1}
  h.should eql(h)
  # => pass

by the way == still works:
  ({:foo => 0, :bar => 1} == {:foo => 0, :bar => 1}).should
  # => Still passes

It works ok with everything else...
I obviously did something wrong. Any clue? Where should I look?

Cheers


More information about the rspec-users mailing list