Chapter 3Test-Driven Rails

In the previous chapter you created some basic functionality for a project-management application using test-driven development. The title of this book, though, is Rails 5 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 you’ll augment your model testing by testing the logic of the entire Rails stack from request to response using end-to-end tests. To do this, you’ll use a tool called Capybara to help write your end-to-end tests.

A good test suite consists of a few end-to-end tests, a lot of tests that target a single unit, and relatively few tests that cover an intermediate amount of code. ...

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.