Chapter 3Test-Driven Rails

In the previous chapter we created some basic functionality for a project-management application using test-driven development. The title of this book, though, is Rails 4 Test Prescriptions, not Generic Test Prescriptions. (As with most generics, if that book did exist, it’d probably be cheaper but with less-interesting packaging.)

In this chapter we will augment our model testing by testing logic in the controller and view layers, and we’ll implement tests that cover our entire Rails application from request to response, called end-to-end tests. We’ll be using a tool called Capybara to help manage our end-to-end testing.

A good test suite consists of a few end-to-end tests, a lot of tests that target a single ...

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.