We cover:
- The difference between acceptance specs and unit specs
- How to use dependency injection to write flexible, testable code
- The use of test doubles / mock objects to stand in for real ones
- How to refactor your specs to keep them clean and readable
Chapter 5Testing in Isolation: Unit Specs
You finished off the last chapter with a working acceptance spec. This spec is (correctly) reporting that the underlying logic isn’t implemented yet. You’re going to start filling in the application skeleton with a working implementation now, picking up where you left off: the HTTP routing layer.
Since you’ll be testing the routing logic in isolation (without a live application server or a real database), you’re going to use unit specs to drive the behavior ...
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.