[ANN] Blue Ridge 1.0: JavaScript Unit Testing for Rails

Blue Ridge 1.0 has been released!

Blue Ridge

by Relevance, http://thinkrelevance.com

Blue Ridge is a JavaScript testing plugin for Rails. It provides
support for both command-line and in-browser JavaScript unit tests,
and it brings the goodness of test-driven and behavior-driven
development to your unobtrusive JavaScript code in a Rails-friendly


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.

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. By providing a friendly convention-over-
configuration wrapper around a collection of great open source tools,
Blue Ridge gives us 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.


  • BDD-style specs for your JavaScript code
  • jQuery and Prototype support
  • Headless execution of JavaScript specs for easy command-line
    execution and integration with your Continuous Integration build
  • In-browser execution of JavaScript specs for testing and debugging
    browser-specific quirks
  • Mocking support via Smoke
  • TextMate integration for running specs from inside TextMate
  • irb-like JavaScript shell for experimentation and debugging


Install Blue Ridge into your Rails app:

./script/plugin install git://github.com/relevance/blue-ridge.git
./script/generate blue_ridge

Blue Ridge creates a small example spec to get you started. Run your
JavaScript specs to make sure that all is well.

rake test:javascripts

Hint: You can also use the “spec:javascripts” or
“examples:javascripts” aliases. Blue Ridge is compatible with your
testing framework of choice, be it test/unit, RSpec, Micronaut,
Shoulda, test-spec, etc.


Installing the plugin creates an example spec (“application_spec.js”),
demonstrating some basic tests to help you get a feel for the
structure of the tests.


Screw.Unit(function() {
  describe("Your application javascript", function() {
    it("provides cliché example", function() {
      expect("hello").to(equal, "hello");

    it("accesses the DOM from fixtures/application.html", function

() {
expect($(’.select_me’).length).to(equal, 2);

This particular spec uses jQuery, but you can optionally configure
your spec to use Prototype.

And, no, we don’t actually encourage you to write tests for standard
libraries like jQuery and Prototype; it just happens to make for an
easy demo.


Check out the README [1] for detailed information on each of the
features described above and for tips and tricks for getting the most
out of Blue Ridge.

Explore the sample app [2] to see more specs and testing techniques in

Use the project’s GitHub issue tracker [3] to let us know about any
issues or ideas for possible improvements. Even better, fork the repo
[1] and start hacking! If you have patches, send us pull requests.

[1] Detailed README - http://github.com/relevance/blue-ridge
[2] Sample Application -
[3] Issues - http://github.com/relevance/blue-ridge/issues


Jason Rudolph

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs