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: ...

Get Rails 4 Test Prescriptions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.