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

Using Capybara

When last we left our application, we allowed for the creation of new projects. Let’s follow up on that and add a sequence where we can see a page for an existing project, and add a task to it. To give this a little bit of back-end logic to play with, let’s set up a situation where the tasks are ordered and we then want to move one task above the other task.

Writing a Test

That test has a few different parts. Let’s take a second to plan the given/when/then of it:

  • Given: We’ll need one existing project and at least one existing task on that project so that we can test the ordering. We’ll probably want two tasks; that way we can verify that the user interface is correct for the first, last, and middle parts of the list.

  • When/Then: ...

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