Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbernar1/0473d3dcc49a97dca981 to your computer and use it in GitHub Desktop.
Save dbernar1/0473d3dcc49a97dca981 to your computer and use it in GitHub Desktop.
Adding a custom matcher for Jasmine
jasmine.Matchers.prototype.toReturnAPromise = function() {
if ( 'function' !== typeof this.actual.then ) {
throw 'Did not return a promise';
}
};
@dbernar1
Copy link
Author

I am not sure that this is a particularly good way to implement this, but it did work for my use case. YMMV. Please let me know if you know of a better way to accomplish this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment