O'Reilly logo

Effective Testing with RSpec 3 by Myron Marston, Ian Dees

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Primitive Matchers

The word primitive in a programming language refers to a bread-and-butter data type that can’t be broken down into smaller pieces. Booleans, integers, and floating-point numbers are all primitives.

RSpec’s primitive matchers are similar. They have simple, precise definitions that can’t be broken down any further. They’re not meant to accept other matchers as input (but you can go the other direction, passing them into other matchers). Typically, they just pass the operation you’re performing—an equality check, for example—straight through to the subject of the expectation.

Equality and Identity

RSpec’s most fundamental matchers are all concerned with variations of the question, “Are these two things the same?” Depending on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required