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

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.

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