Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Sample Rails project demonstrating JavaScript testing with Blue-Ridge

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 test
Octocat-spinner-32 vendor Updated to latest Blue Ridge. February 20, 2010
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
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.

Something went wrong with that request. Please try again.