We cover:

  • A tour of the included matchers
  • The difference between primitive and higher-order matchers
  • The difference between value and block expectations

Chapter 11Matchers Included in RSpec Expectations

In the previous chapter, you learned how to write expectations to check your code’s behavior. You got to know the various parts of an expectation, such as the subject and the matcher.

Now, it’s time to take a closer look at matchers. You’ve called them in your specs and combined them with other matchers. You’ve even written a simple one from scratch, though most of the time you won’t have to. RSpec ships with a ton of useful matchers to help you specify exactly how you want your code to behave.

In this chapter, we’re going to take a tour of RSpec’s ...

Get Effective Testing with RSpec 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.