Okay, Funny Man, What Makes a Good Set of Model Tests?

There are a lot of different, sometimes conflicting, goals for tests. It’s hard to know where to start your TDD process, how many tests to write, and when you’re done. The classic description of the process—“write a simple test, make it pass, then refactor”—doesn’t provide a lot of affirmative guidance or direction for the larger process of adding a feature.

A TDD Metaprocess

The following diagram illustrates a metaprocess that reflects how I write a new business-logic feature. (I handle view logic a little differently.) This process is more of a guideline than a hard-and-fast checklist. As the logic gets more complex, and the less I know about the implementation when I start, the closer ...

Get Rails 5 Test Prescriptions 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.