Skip to content

Instantly share code, notes, and snippets.

@fantactuka
Created September 19, 2012 09:47
Show Gist options
  • Save fantactuka/3748753 to your computer and use it in GitHub Desktop.
Save fantactuka/3748753 to your computer and use it in GitHub Desktop.
Adding jasmine matches in helper outside beforeEach (to speedup)
// Hacking Jasmine: adding matchers outside beforeEach to speed up code
jasmine.addMatchers = function(matchers) {
var parentClass = jasmine.getEnv().matchersClass;
var matchersClass = function() {
parentClass.apply(this, arguments);
};
jasmine.util.inherit(matchersClass, parentClass);
jasmine.Matchers.wrapInto_(matchers, matchersClass);
jasmine.getEnv().matchersClass = matchersClass;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment