Jasminerice

Utilizing Jasmine and taking full advantage of the Rails 3.1 asset pipeline. jasmine-stories removes any excuse YOU have for not testing your out of control application. This project rocks and uses the MIT-LICENSE.

Headless Testing

See guard-jasmine for details.

Installation

This is a gem specifically for Rails 3.1. Just include it in your Gemfile:

group :development, :test do
  gem "jasmine-stories"
end

The engine is automatically mounted into your application in the development and test environments. If you'd like to change that behavior, you can override the array JasmineStories.environments in an initializer.

Usage

CoffeeScripts

Create a file spec/javascripts/stories.js.coffee with the following content:

#=require_tree ./stories

This pulls in all your specs from the javascripts/stories directory into Jasmine:

spec/javascripts/stories/*_story.js.coffee
spec/javascripts/stories/*_story.js
spec/javascripts/stories/*_story.js.erb

The Rails 3.1 asset pipeline using Sprockets and Tilt ensure conversion.

As well you can use the #require dependency mechanisms in your specs to pull dependencies. Here's an example spec/javascripts/foo.js.coffee:

#= require foo
#= require bar

describe "Foo", ->
  it "it is not bar", ->
    v = new Foo()
    expect(v.bar()).toEqual(false)

describe "Bar", ->
  it "it is not foo", ->
    v = new Bar()
    expect(v.foo()).toEqual(false)

Stylesheets

For including stylesheets in your specs, Jasminerice uses spec/javascripts/spec.css. Use Sprockets directives to include the right css files:

/*
 *= require application
 */

Start server

Now start your server

rails s

Goto

http://localhost:3000/jasmine-stories

and there are your acceptance tests.

Author