Created: 2011-07-18 10:10
Updated: 2017-05-27 19:48
License: mit


JS Fixtures

A gem that allows controller specs to generate markup which can be used as HTML fixtures within javascript tests written using Jasmine and JSTestDriver.


  • Add the dependency for your gem in Gemfile:

    gem 'js_fixtures',:require => false
  • Add the require in spec_helper.rb

    require 'js_fixtures'
  • Within the controller specs, call the method to create fixtures as follows:


The above will save the content of the body in file Signup.js in the path 'spec/javascripts/helpers/'. The file will have a method loadSignupFixture which contains the HTML fixture.

  • Call the same in the JS tests in beforeEach section:
beforeEach(function () {
  $(this).ready(function () {


See the CONTRIBUTING document. Thank you, contributors!


JS Fixtures is Copyright (c) 2016 Multunus Software Pvt. Ltd. It is free software, and may be redistributed under the terms specified in the LICENSE file.



JS Fixtures is maintained and funded by Multunus Software Pvt. Ltd. The names and logos for Multunus are trademarks of Multunus Software Pvt. Ltd.

We love open source software! See our other projects or hire us to help build your product.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more