public
Created

A Spock unit test to validade a simple division method

  • Download Gist
CalculatorSpec.groovy
Groovy
1 2 3 4 5 6 7 8 9 10 11 12
when: "I divide a number by another"
def result = controller.divide firstNumber, secondNumber
 
then: "I should get the correct value"
result == expectedResult
 
where: "The values are as following"
 
firstNumber | secondNumber | expectedResult
10 | 5 | 2
36 | 6 | 6
-10 | -1 | 10

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.