Making the Test Pass

In this section you’ll set up the JavaScript and present some passing code without unit testing. In the next chapter you’ll set up JavaScript unit-testing tools and see how you might test-drive JavaScript features.

Rails 5.1 makes two important changes to the JavaScript environment:

  • jQuery is no longer a default dependency.
  • Webpack integration is available via the Webpacker gem.[31] [32]

Webpack is an optional replacement for the Rails asset pipeline and has the same general purpose: take files that might be written in JavaScript, CoffeeScript, TypeScript, Elm, or another language, and build them into JavaScript files that can be passed to the browser. Webpack’s advantage is that it’s flexible, it’s tied into the current ...

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.