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

Greg Hauptmann greg.hauptmann.ruby at gmail.com
Sat Nov 8 00:37:10 EST 2008


thanks Pat - yes I missed it when reading your email - I'd been using
".eql" for everything....thanks

On Sat, Nov 8, 2008 at 2:10 PM, Pat Maddox <pergesu at gmail.com> wrote:
> "Greg Hauptmann" <greg.hauptmann.ruby at gmail.com> writes:
>
>> in fact I guess I was fishing for an easier way than this...if one
>> exists?  or is ruby & rspec "eql()" just strict here in terms of
>> types?
>>
>> On 11/7/08, Mark Wilden <mark at mwilden.com> wrote:
>>> On Fri, Nov 7, 2008 at 3:24 PM, Greg Hauptmann <
>>> greg.hauptmann.ruby at gmail.com> wrote:
>>>
>>>>
>>>>     expected 6.5, got #<BigDecimal:23d8284,'0.65E1',8(8)> (using .eql?)
>>>>
>>>
>>> How about just expecting BigDecimal('5.5')?
>>>
>>> ///ark
>>>
>
> I'm not sure if you got my email before, but 6.5 ==
> BigDecimal.new('6.5').  So use == instead and you should be good.
>
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list