We cover:
- How to return, raise, or yield a value from your double
- How to supply custom behavior for your double
- How to ensure your double is called with the right arguments
- How to make sure your double is called the right number of times and in the right order
Chapter 14Customizing Test Doubles
Now that you’ve got a handle on the basic types of test doubles and when to use them, we’re going to dive into the rspec-mocks API for a bit. Our goal isn’t to give you an exhaustive API reference here; that’s what the docs are for.[97]
Instead, we’re going to show you the basics, and then give a few recipes for specific situations.
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.