Skip to content

Instantly share code, notes, and snippets.

@mdix
Created December 18, 2014 12:35
Show Gist options
  • Save mdix/12e6aa27f80ba6c010af to your computer and use it in GitHub Desktop.
Save mdix/12e6aa27f80ba6c010af to your computer and use it in GitHub Desktop.
jasmine data provider
define(['lib/validator/rule.notEmpty'], function(_ruleNotEmpty_) {
describe('rule.notEmpty', function() {
var ruleNotEmpty;
beforeEach(function() {
ruleNotEmpty = new _ruleNotEmpty_();
});
describe('its checkField function', function() {
// just wrap an it in a loop (if you have jquery you can use each)
$.each(['blah', ' blubb', ' blah ', ' 123\t'], function(index, value) {
it('should return true with other non empty strings (cur: ' + value + ')', function(done) {
expect(ruleNotEmpty.checkField(value)).toBe(true);
done();
});
});
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment