Blankman
Blankman

Reputation: 267260

rspec fails saying expected: 15.35, got: 15.35 using ==, this doesn't make sense to me?

My rspec is failing, but both the expected and got values are identical.

It shows:

expected: 15.35
     got: 15.35  (using ==)

Is this a datatype issue?

Upvotes: 1

Views: 224

Answers (1)

Ryanmt
Ryanmt

Reputation: 3265

Well, this is probably just a float comparison issue. I think that the common solution is as suggested here: http://blog.daveastels.com/files/QuickRef.pdf

# Floating Point Comparison
object.should be_close <val>, <delta>
object.should_not be_close <val>, <delta>

Upvotes: 6

Related Questions