O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Outside-in Testing

The process we’ll use to manage our Capybara tests is sometimes called outside-in testing—we start using Capybara to write a test from the outside and use that test to drive our unit tests. In the same way that TDD uses a failing unit test to drive code, outside-in testing uses a failing acceptance test (or a failing line in an acceptance test) to drive the creation of unit tests.

The process follows Figure 1, Outside-in testing—we’re assuming the creation of a new user-facing feature in a Rails application.

images/outside_in.png
Figure 1. Outside-in testing

Let’s walk through the steps.

  1. Write the end-to-end test that shows a user interacting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required