I have just started using ScalaTest and I am using the following to compare two Doubles in my spec as follows:
it should \"calculate the price\" in {
v
You can simply do actual shouldBe (expected +- tolerance) if using FlatSpec; other specs have similar matchers instead of shouldBe. It gives better messages in case of failures than assert, and the code is consistent with the other tests.
It looks to me like you've got an implicit instance of Equality[Double] in scope along the lines of org.scalactic.TolerantNumerics, for which the documentation is here.
The example from the doc is:
implicit val doubleEquality = TolerantNumerics.tolerantDoubleEquality(0.01)
But it looks like somebody has instantiated it with a really big tolerance value in your case.
You may also consider trying explicit tolerance by using +-:
assert(x.price() === 185.92 +- 0.01)