Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A port of the RedGreen gem to use with JSpec and Johnson
JavaScript Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.markdown
redgreen.js
ruby_escape.rb

README.markdown

RedGreen for Johnson/jspec

Colorize the Javascript test output in your terminal

A Javascript version of the Ruby gem redgreen

Designed to work with the version of jspec that ships with Johnson

HowTo

First, install Johnson:

$ sudo gem install jbarnette-johnson --source http://gems.github.com

Then try it out by creating a new jspec test case. Copy the following code into a test file called test.js

// this code just prevents you from having to type
//    'johnson -I /path/to/johnson'
// provided to make this example easily testable
for (var dir in Ruby["$LOAD_PATH"])
  if(/johnson-[\d-\.]+\/lib$/.test(dir)) break
dir = dir.split('/'); dir.pop();
Ruby["$LOAD_PATH"].unshift(dir.join("/"))
Ruby["$LOAD_PATH"].unshift('.')

// K, from here on is what you'd normally use
Johnson.require("test/jspec/helper");
Johnson.require("test/jspec/jspec");
Johnson.require('redgreen/redgreen') // <- or wherever you saved it.

Me = {quality: 'awesome'}
jspec.describe("Let's go testing", function() {
  it("should think I'm awesome", function() {
    expect('awesome').to("==", Me.quality);
  })
  it("should work just fine", function() {
    expect('not going to work').to("==", 'miserable failure');
  })
})

And run it like so:

$ johnson test.js

output from 'johnson test.js'

Known Bugs

Currently only does red. I know, I know. Only two features and they're in the name of the library. But it only does red. Please fork jspec and fix the way it handles successes if you want this fixed.

Something went wrong with that request. Please try again.