From Acceptance Specs to Unit Specs

We should take a moment to revisit what we mean by “unit specs.” The common term unit testing means different things to different people—or even to the same person on different projects. Unit tests typically involve isolating a class or method from the rest of the code. The result is faster tests and easier-to-find errors.

Where unit testing approaches differ is the degree of isolation; that is, whether to remove every possible dependency or to test a related group of collaborating objects together. In this book, we’ll use unit spec to refer to the fastest, most isolated set of tests for a particular project. For more information, see Martin Fowler’s article on the subject.[35]

With the unit tests in this ...

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.