diff --git a/History.md b/History.md index e03f91f..9117f86 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,10 @@ +0.3.3 / 2014-??-?? +================== + + * added .lessThanOrEqual() and .greaterThanOrEqual() + + 0.3.0 / 2014-02-20 ================== diff --git a/index.js b/index.js index b1e921d..4f0f91a 100644 --- a/index.js +++ b/index.js @@ -301,6 +301,22 @@ return this; }; + /** + * Assert numeric value above or equal _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.greaterThanOrEqual = + Assertion.prototype.aboveOrEqual = function (n) { + this.assert( + this.obj >= n + , function(){ return 'expected ' + i(this.obj) + ' to be above or equal ' + n } + , function(){ return 'expected ' + i(this.obj) + ' to be below ' + n }); + return this; + }; + /** * Assert numeric value below _n_. * @@ -317,6 +333,22 @@ return this; }; + /** + * Assert numeric value below or equal _n_. + * + * @param {Number} n + * @api public + */ + + Assertion.prototype.lessThanOrEqual = + Assertion.prototype.belowOrEqual = function (n) { + this.assert( + this.obj <= n + , function(){ return 'expected ' + i(this.obj) + ' to be below or equal ' + n } + , function(){ return 'expected ' + i(this.obj) + ' to be above ' + n }); + return this; + }; + /** * Assert string value matches _regexp_. * diff --git a/test/common.js b/test/common.js index c39ba1e..edfdba3 100644 --- a/test/common.js +++ b/test/common.js @@ -4,4 +4,4 @@ */ // expose the globals that are obtained through `