Matchers

As always there are many sitations where we need specific matchers to test situations. And for this RSpec has a lot of built in matchers that we can user depending on those sitations.

Equivalence matchers

Equivalence matchers are used to comparing values and variables. These are the most commenly used in RSpec. In ruby there are different ways to compare values. And the result varies on how strict you want to be when comparing values. For example 1 and 1.0 are very close but not exactly the same. We have to keep this in mind when using equivalence matchers.

Truthiness matchers

Numeric comparison matchers

Collections

Predicate matchers

Observation matchers

Last updated