public
Description: Sample Rails project demonstrating JavaScript testing with Blue-Ridge
Homepage:
Clone URL: git://github.com/relevance/blue-ridge-sample-app.git
name age message
file .gitignore Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
file LICENSE Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
file README.markdown Mon May 04 18:26:08 -0700 2009 Update README - Add link to CI builds on runcod... [jasonrudolph]
file Rakefile Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
directory app/ Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
directory config/ Fri Aug 21 12:39:00 -0700 2009 Update to use latest version of Rails (v2.3.3) [jasonrudolph]
directory db/ Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
directory public/ Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
directory script/ Mon May 04 17:59:32 -0700 2009 Initial commit [jasonrudolph]
directory test/ Sat Aug 08 20:12:33 -0700 2009 Added a doubly-nested test. [karnowski]
directory vendor/ Fri Aug 28 06:44:04 -0700 2009 Updated Blue Ridge plugin. [karnowski]
README.markdown

ScalaEnvy (Blue-Ridge Sample App)

Welcome to the sample application for Blue-Ridge. Blue-Ridge is a JavaScript testing plugin for Rails. Blue-Ridge adds support for command-line and in-browser JavaScript unit tests to your Rails app, allowing you to give your JavaScript code the testing love it deserves.

This sample application demonstrates:

  • using nested describe functions
  • setting up per-spec HTML "fixtures"
  • stubbing functions
  • mocking functions
  • running the Blue Ridge specs as part of your default Rake task

To verify that all the tests pass, clone the repo and follow the instructions below, or simply check out the app's latest build on RunCodeRun.

Noteworthy Bits

  • public/javascripts/project.js: the JavaScript code used to power the app's client-side interactivity
  • test/javascript/project_spec.js: the specs for the JavaScript code present in public/javascripts/project.js
  • test/javascript/spec_helper.js: the helper code used by project_spec.js and available to any other JavaScript specs you might define for the app

Installing and Running

To install:

git clone git://github.com/relevance/blue-ridge-sample-app.git scalaenvy
cd scalaenvy
cp config/database.sample.yml config/database.yml
rake db:migrate

To run all of the JavaScript specs:

rake test:javascripts

To run all of tests (i.e., Ruby and JavaScript):

rake

To run the application:

script/server 

The sample app should now be running at http://localhost:3000

Notes

This sample app uses jQuery exclusively, but Blue-Ridge plays nicely with Prototype as well. Check out the Blue-Ridge README for an example of testing JavaScript that relies on Prototype.