Your Turn

In this chapter, you’ve clarified exactly how your API is supposed to behave. You’ve spelled out what happens when storing an expense record succeeds or fails, using a test double to stand in for the unwritten persistence layer. You’ve refactored your specs so that they spell out exactly what behavior you’re testing. Finally, you’ve used the design suggested by your tests to guide the interface of a real object.

Now, it’s time to put these new skills to the test. Don’t skip this one; you’re going to build on this work in the next chapter.

Exercises

In these exercises, you’re going to implement another key piece of your application at the routing layer. Along the way, you’ll be looking for opportunities to share code.

Reducing Duplication ...

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.