chriso/node-validator — pull request #102 by osher (2012-08-05 16:23:15+00:00)
Title: adding validator#throws(boolean)

consider the following two cases, expressed in the tests bellow

{code}

'test #throws(false) stops throwing': function() {
var c = (new node_validator.Validator()).check(1).throws(false);
assert.doesNotThrow( function() {
c.min(2);
c.max(0);
});
assert.equal(c._errors.length, 2);
},
'test #throws(true) brings back throwing' : function() {
var c = (new node_validator.Validator()).check(1);

c.throws(false);
assert.doesNotThrow( function() {
c.min(2);
c.max(0);
});
assert.equal(c._errors.length, 2);

c.throws(true);
assert.throws( function() {
c.min(2);
c.max(0);
});
assert.equal(c._errors.length, 3);
}

{code]