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 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 ...

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