Skip to content

Instantly share code, notes, and snippets.

@johnathan-sewell
Created May 8, 2014 08:42
Show Gist options
  • Save johnathan-sewell/2cad50b335aa62ed4cbc to your computer and use it in GitHub Desktop.
Save johnathan-sewell/2cad50b335aa62ed4cbc to your computer and use it in GitHub Desktop.
Dry Jasmine "it" blocks in forEach
describe('validation', function() {
['startDate', 'endDate'].forEach(function(key) {
it('expects ' + key + ' to be in ISO format', function() {
model.set(key, '2014-04-29T15:04:53.078Z');
expect(model.isValid()).toEqual(true);
model.set(key, '2014/04/29');
expect(model.isValid()).toEqual(false);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment