Skip to content

Instantly share code, notes, and snippets.

@stalniy
Created June 25, 2018 18:32
Show Gist options
  • Save stalniy/d674863f9ad665a74c235760b385136d to your computer and use it in GitHub Desktop.
Save stalniy/d674863f9ad665a74c235760b385136d to your computer and use it in GitHub Desktop.
Lazy vars shared validators
sharedExampleFor('Range validator', function(fieldName, min, max) {
it('rejects values greater than "max" value', function() {
$subject[fieldName] = max() + 1;
expect($subject.hasErrorOn(fieldName)).to.be.true;
});
it('rejects values less than "min" value', function() {
$subject[fieldName] = min() - 1;
expect($subject.hasErrorOn(fieldName)).to.be.true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment