What You’ve Done
In this chapter we looked at using integration-testing tools, specifically Capybara, to test JavaScript from outside the client-side code. If you’re getting the sense that using JavaScript drivers with Capybara is flaky, brittle, and frustrating, the only thing I can say is that you left out slow. I recommend using those drivers sparingly. Handle testing client interactions in JavaScript to the extent possible, and use server-side testing to specify what data is sent to the client.
Now let’s look at how you can unit-test that JavaScript.
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.