On stage at Red Dirt Ruby Conference, Noel Rappin has released Summer Breeze, a gem that makes working with Jasmine in Rails a bit easier. Summer Breeze dynamically creates Rails fixtures for your Jasmine tests.

Installation and usage

To install via RubyGems:

gem install summer_breeze

… and run the bundled generator:

rails generate summer_breeze:install

Now you can define you fixtures in the generated initializer:

fixture "PostsController##index.body_container"

You then have several options for telling Jasmine about your new
fixture:

sb.loadFixture(fixture_name)
sb.findSelector(fixture_name, selector)
sb.readFixture(fixture_name)

A sample test might look like:

it("hides text when asked", function() {
  $form_container = sb.findSelector('login', '.form_container');
  toggle_handlers.init();
  $hide_link = $form_container.find(".toggle_link");
  expect($hide_link).not.toHaveClass("hidden");
  $hide_link.click();
  expect($hide_link).toHaveClass("hidden");
});

Be sure and check the
Readme for advanced
usage and limitations.

[Source on GitHub]


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.