Integration-Testing JavaScript with Capybara

In the last chapter you used Capybara to test buttons in the UI that allowed you to change the order of tasks. As written, clicking up on a task button causes a full server page refresh. This is an interaction that might be more user-friendly if handled client-side with JavaScript.

There are multiple ways to handle this client-side. For our purposes the simplest is to have the up and down buttons manipulate the browser DOM to change the order and send an update request back to the server to register the other change. You need to test two things: that the client interaction actually changes the DOM, and that the changes are sent back to the server accurately.

I want to split the integration test for ...

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.