Wynn Netherland changelog.com/posts

Summer Breeze: creates dynamic Rails fixtures for Jasmine tests

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]


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00