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

Your Turn

In this chapter, we saw several different ways to configure how your test doubles respond to messages. We talked about how to return, raise, or yield specific values. We saw how to replace a method from a real class but still use the original implementation behind the scenes.

We also discussed how to constrain whether a double should respond at all for certain message arguments. By constraining what arguments a message expectation accepts, and how many times it must be called, you can be as specific or as loose as you need in your specs.

Exercises

For these exercises, you’re going to dig a little more deeply into the block implementations from When You Need More Flexibility. Block implementations are the catch-all of RSpec mocks: ...

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