Skip to content

Instantly share code, notes, and snippets.

@trivektor
Forked from mxriverlynn/1.js
Created January 17, 2012 05:32
Show Gist options
  • Save trivektor/1624939 to your computer and use it in GitHub Desktop.
Save trivektor/1624939 to your computer and use it in GitHub Desktop.
hacking jasmine-jquery setFixtures
function addFixture(html){
var fixtures = jasmine.getFixtures();
if (!fixtures.fixtureList){
fixtures.fixtureList = [];
}
fixtures.fixtureList.push(html);
fixtures.set(fixtures.fixtureList.join());
}
function clearMyFixtures(){
delete jasmine.getFixtures().fixtureList;
}
describe("something", function(){
beforeEach(fucntion(){
addFixture("<div id='something'></div>");
addFixture("<ul></ul>");
});
afterEach(function(){
clearMyFixtures();
});
it("does that thing", function{
// ... your test that uses a fixture, here
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment