O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit-Testing JavaScript

We are lucky enough to already have an interaction in our application that can be converted to JavaScript without much trouble and without being wildly implausible. We’ll go back to the project show page and convert those up and down buttons to JavaScript-enabled buttons that respond to clicks by rearranging the two rows in question and sending an Ajax notification of the change back to the server.

Setting Up Jasmine

We’ll be using Jasmine 2.0 as our primary JavaScript testing engine. Complete Jasmine documentation is at http://jasmine.github.io/2.0/introduction.html, and will cover any corners of the framework that we don’t get to here.

I like Jasmine because of its RSpec-like syntax, and it has historically been relatively ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required