Origins: Pure, Partial, and Verifying Doubles
Now that we’ve seen the different usage modes of test doubles, let’s look at where they come from.
All of the test doubles you’ve written so far in this chapter are pure doubles: they’re purpose-built by rspec-mocks and consist entirely of behavior you add to them. You can pass them into your project code just as if they were the real thing.
Pure doubles are flexible and easy to get started with. They’re best for testing code where you can pass in dependencies. Unfortunately, real-world projects are not always so tester-friendly, and you’ll need to turn to more powerful techniques.
Sometimes, the code you’re testing doesn’t give you an easy way to inject dependencies. ...