README.md in jasminerice-0.0.7 vs README.md in jasminerice-0.0.8

- old
+ new

@@ -1,80 +1,117 @@ Jasminerice =========== -Utilizing (jasmine)[http://pivotal.github.com/jasmine/] and taking full advantage -of the Rails 3.1 asset pipeline jasmine rice removes any excuse YOU have for -not testing your out of control sprawl of coffeescript files. -This project rocks and uses MIT-LICENSE. +Utilizing [Jasmine](http://pivotal.github.com/jasmine/) and taking full advantage +of the Rails 3.1 asset pipeline. Jasminerice removes any excuse YOU have for +not testing your out of control sprawl of CoffeeScript files. +This project rocks and uses the MIT-LICENSE. -Setup For Rails 3.1 -------------------- +Headless Testing +---------------- -This is a gem specifically for Rails 3.1. Just include it in -your Gemfile so +See [guard-jasmine](https://github.com/netzpirat/guard-jasmine) for details. - gem "jasminerice" +Installation +------------ -Now add a route to the end of your config.routes but only for development and test +This is a gem specifically for Rails 3.1. Just include it in +your `Gemfile`: - if ["development", "test"].include? Rails.env - mount Jasminerice::Engine => "/jasmine" - end +```ruby +group :development, :test + gem "jasminerice" +end +``` -Create a single file called +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 `Jasminerice.environments` in an initializer. - specs/javascripts/spec.js.coffee +Usage +----- -with the following content +### CoffeeScripts +Create a file `spec/javascripts/spec.js.coffee` with the following content: + #=require_tree ./ -This pulls in all your +This pulls in all your specs from the `javascripts` directory into Jasmine: - specs/javascripts/*_spec.js.coffee - specs/javascripts/*_spec.js - specs/javascripts/*_spec.js.erb - etc +```bash +spec/javascripts/*_spec.js.coffee +spec/javascripts/*_spec.js +spec/javascripts/*_spec.js.erb +``` -into jasmine. For example +The Rails 3.1 asset pipeline using [Sprockets](https://github.com/sstephenson/sprockets) +and [Tilt](https://github.com/rtomayko/tilt) ensure conversion. -spec/javascripts/foo.js.coffe +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 +```coffeescript +#= require foo +#= require bar - describe "Foo", -> +describe "Foo", -> + it "it is not bar", -> + v = new Foo() + expect(v.bar()).toEqual(false) - it "it is not bar", -> - v = new Foo() +describe "Bar", -> + it "it is not foo", -> + v = new Bar() + expect(v.foo()).toEqual(false) +``` - expect(v.bar()).toEqual(false) +### Stylesheets - describe "Bar", -> +For including stylesheets in your specs, Jasminerice uses `spec/javascripts/spec.css`. +Use Sprockets directives to include the right css files: - it "it is not foo", -> - v = new Bar() +```css +/* + *= require application + */ +``` - expect(v.foo()).toEqual(false) +### Fixtures +Jasminerice makes files located in the `spec/javascripts/fixtures` directory available +as fixture. For example, a file `spec/javascripts/fixtures/baz.html.haml` with the +following content: -The Rails 3.1 asset pipeline using sprockets and tilt -ensure conversion. As well you can use the #require -dependency mechanisms +```haml +%h2 Test Fixture +%p Using fixtures +``` +is made available under the URL `/jasmine/fixtures/baz`. Since Jasminerice automatically +makes a patched version of [jasmine-jquery](https://github.com/velesin/jasmine-jquery) +available in your specs, you can load the `baz` fixture in your spec with: + +```coffeescript +loadFixtures 'baz' +``` + +### Start server + Now start your server - rails s +```bash +rails s +``` Goto - http://localhost:3000/jasmine +```bash +http://localhost:3000/jasmine +``` and there are your specs. -Questions: +Author +------ - bradphelan@xtargets.com - - - - +* Brad Phelan (bradphelan@xtargets.com)