Skip to content

Instantly share code, notes, and snippets.

@joecorcoran
Created October 2, 2012 10:48
Show Gist options
  • Save joecorcoran/3818133 to your computer and use it in GitHub Desktop.
Save joecorcoran/3818133 to your computer and use it in GitHub Desktop.
Jasmine toBeNear matcher
beforeEach(function() {
this.addMatchers({
toBeNear: function(expected, within) {
within = within || 1;
return (this.actual >= (expected - within)) && (this.actual <= (expected + within));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment