All Projects → relevance → blue-ridge-sample-app

relevance / blue-ridge-sample-app

Licence: MIT License
Sample Rails project demonstrating JavaScript testing with Blue-Ridge

Programming Languages

javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].