Part 4RSpec Expectations

With rspec-expectations, you can easily express expected outcomes about your code. While the syntax might initially look odd or even “magical,” under the covers it uses simple matcher objects that can be composed in useful, powerful ways.

In this section, we’ll dig into how rspec-expectations works, how to compose matchers, and why doing so is useful. We’ll take a tour of the matchers included in RSpec and then show you how to create your own domain-specific matchers for your projects.

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.