Chapter 10. Testing Your Application

Smart developers test their code. Take a minute to read that sentence again, and let it sink in: smart developers test their code. The fact is, testing is one of the most important things you can do to improve the quality of your code, reduce the cost of change, and keep your software bug-free. Rails (and the Ruby community at large) takes testing seriously. Not surprisingly, Rails goes out of its way to make testing hassle-free.

The basic idea of testing is simple: you write code that exercises your program and tests your assumptions. Instead of just opening a browser and adding a new user manually to check whether the process works, you write a test that automates the process—something repeatable. With ...

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