Skip to content

Instantly share code, notes, and snippets.

@deckar01
Last active March 7, 2016 22:00
Show Gist options
  • Save deckar01/6d2b339ec273212508c4 to your computer and use it in GitHub Desktop.
Save deckar01/6d2b339ec273212508c4 to your computer and use it in GitHub Desktop.
Failed attempt at promise matchers wrapper for jasmine 2
beforeEach(function () {
jasmine.Matchers = {prototype: {}};
jasmine.Env = {prototype: {}};
require('promise-matchers');
Object.keys(jasmine.Matchers.prototype).forEach(function(key) {
var matcher = jasmine.Matchers.prototype[key];
jasmine.Matchers.prototype[key] = function() {
return {
compare: function(actual, done, expected) {
actual.toString = function() { return 'Promise'; };
var self = {
actual: actual,
env: jasmine.Env.prototype
};
return {
pass: matcher.call(self, done, expected)
};
}
}
}
});
jasmine.addMatchers(jasmine.Matchers.prototype);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment