Using Feature Tests to Build a Feature
When last you left your application, you allowed for the creation of new projects. Let’s follow up on that and add a sequence where you 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 then move one task above the other task.
Writing a Test
This test has a few parts. Let’s take a second to plan the given/when/then:
-
Given: You’ll need one existing project and at least one existing task on that project so that you can test the ordering. You’ll probably want two tasks; that way you can verify that the user interface is correct for the first, last, and middle parts of the list.
-
When/then: ...
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.