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:

  • The importance of carefully constructing an environment for each spec
  • How to provide test doubles to the code you’re testing
  • What the most common pitfalls are and how to avoid them
  • How to improve your code by applying design feedback from your test doubles

Chapter 15Using Test Doubles Effectively

Over the previous two chapters, you’ve tried out mocks, stubs, spies, and null objects. You’ve learned which situations each is best for. You’ve also seen how to configure their behavior, and how to check that a test double is called correctly.

Now we’d like to talk about the trade-offs. Although we frequently use doubles in our specs, we’ll be the first to acknowledge that doing so incurs some risk. Here are some of the problems you can run ...

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