Added toBeLessThan and toBeGreaterThan matchers.

This commit is contained in:
Aaron Peckham & Christian Williams
2009-08-14 15:39:28 -07:00
parent 3e68a2c2bc
commit ca077342f3
3 changed files with 32 additions and 0 deletions

View File

@@ -216,6 +216,16 @@ jasmine.Matchers.prototype.toNotContain = function(item) {
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
};
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
return this.report(this.actual < expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
}
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
return this.report(this.actual > expected,
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
}
/**
* Matcher that checks that the expected exception was thrown by the actual.
*