Chapter 10. Testing

So far, you’ve tested your code by typing in the Rails console and clicking links in the web browser. As you add more features to your application, however, this won’t scale. And even with more effective test methods, you’ll still have to remember to retest everything in the application after you add each feature. Otherwise you might miss a regression.

Rather than manually testing your application, you can write automated tests in Ruby to ensure your code is correct and meets all of your requirements. Once you have a set of automated tests in place, you can run an entire suite of tests to catch regressions, helping you to refactor your code with confidence.

Several different test frameworks are available for Ruby. In ...

Get Rails Crash Course 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.