The Big Two

If a programming practice or tool is successful, following or using it will make it easier to:

  • add the code I need in the short term.

  • continue to add code to the project over time.

All kinds of gems in the Ruby and Rails ecosystem help with the first goal (including Rails itself). Testing is normally thought of as working toward the second goal. That’s true, but often people assume the only contribution testing makes toward long-term application health is verification of application logic and prevention of regressions. In fact, over the long term test-driven development tends to pay off as good tests lead toward modular designs.

This means a valuable test saves time and effort over the long term, while a poor test costs time and ...

Get Rails 4 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.