Brought to you by www.skinnyboard.com
Testing JS in Rails - Tuesday May 5th, 2009 @ 1:45pm
==============================================
- rake js/fixtures - > will run in browser
- Screw.Unit and Smoke
- You can stub out jQuery and Prototype instead of testing them
- uses HTML fixtures
- but those could be limiting, thus you can do an almost factory girl approach and use jQuery to generate an HTML snippet to act as your HTML fixture
- blueridge plugin for rspec similar testing functionality
From the Git Project Page
======================
Blue Ridge JavaScript Testing Rails Plugin
The Blue Ridge JavaScript Testing Rails Plugin adds support for command-line and in-browser JavaScript unit tests to your Rails app. It bundles several great tools together in a convention-over-configuration, Rails-like way. These tools include:
* Rhino - a Java-based JavaScript interpreter
* Screw.Unit - a behaviour-driven development syntax for JavaScript similar to RSpec
* Smoke - a JavaScript mocking & stubbing library similar to Mocha
* env.js - a DOM implementation written entirely in JavaScript
=======================
How to get started?
=====================
- blueridge is a plugin that combines several usefull JS testing tools
- there is an awesome Textmate bundle that gives snippets and allows you to run tests from within Textmate
- Project Page: github.com/relevance/blue-ridge
Benefits
=====================
- BDD JavaScript code similar to rspec or mocha
- Pair programming in JavaScript
Drawbacks
===================
- based on Screw.Unit whose development is outdated - they're working on this...
Brought to you by www.skinnyboard.com