[rspec-users] any tricks re using " eql(5.5)", but where 5.5 is a decimal not float?

Pat Maddox pergesu at gmail.com
Fri Nov 7 18:51:29 EST 2008

"Greg Hauptmann" <greg.hauptmann.ruby at gmail.com> writes:

Do you mean BigDecimal?  Anyway, you should probably be using == instead
of eql.

>> 5.5 == BigDecimal.new('5.5')
=> true
>> 5.5.eql? BigDecimal.new('5.5')
=> false

eql? is object identity and is generally not what you're after.


More information about the rspec-users mailing list