JavaScript Testing in Rails - RailsConf

You wouldn’t consider developing a Rails application without having a solid test suite for your Ruby code, but you’ve somehow convinced yourself to cross your fingers and look the other way when it comes to JavaScript.

It doesn’t have to be that way. In this session, you’ll learn how to apply test-driven and behavior-driven development to your unobtrusive JavaScript code in a Rails-friendly manner.

Historically, when selecting a JavaScript testing solution, you were forced to choose whether you wanted a framework that could run your tests in the browser or one that could only run your tests in a headless fashion. With the right combination of tools [1], you can enjoy the best of both worlds: fast, automation-friendly, and headless testing plus the ability to run your tests in whichever browser is acting up on any given day.

In this session, you’ll learn how to give your JavaScript code the testing love it deserves. We’ll tackle:

- Choosing and configuring a JavaScript testing framework
- Writing RSpec-style specifications for test-first JavaScript development
- Adding jQuery, Prototype, or other libraries to the mix
- Coding in true red-green-refactor fashion with TextMate
- Running tests in the browser
- Running JavaScript tests headlessly with Rake
- Automating your tests with Continuous Integration