Skip to content

Instantly share code, notes, and snippets.

@avishaan
Created October 30, 2014 05:42
Show Gist options
  • Save avishaan/cdd87ef1ce1863929be1 to your computer and use it in GitHub Desktop.
Save avishaan/cdd87ef1ce1863929be1 to your computer and use it in GitHub Desktop.
Jasmine test multi values with same 'it' spec
describe("A calculator", function() {
it("should square correctly", function() {
[
{ number: 2, answer: 4},
{ number: 3, answer: 9},
{ number: 4, answer: 16}
].forEach(function(problem, index, array){
// we will pretend to calculate with our fnc here
var calcAnswer = problem.number*problem.number;
expect(calcAnswer).toEqual(problem.answer);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment