Skip to content

Instantly share code, notes, and snippets.

View tilmanschweitzer's full-sized avatar

Tilman Schweitzer tilmanschweitzer

View GitHub Profile
@heat
heat / jasmine.matcher.toBeInstanceOf.js
Created September 4, 2012 19:45
Jasmine Matcher instanceof
beforeEach(function() {
this.addMatchers({
toBeInstanceOf: function(expectedInstance) {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
this.message = function() {
return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name;
};
return actual instanceof expectedInstance;
}