Created
October 12, 2012 14:14
-
-
Save hhariri/3879379 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package samples | |
import kspec.framework.* | |
spec public fun calculatorSpecs() { | |
given("a calculator", { | |
val calculator = Calculator() | |
on("calling sum with two numbers", { | |
val sum = calculator.sum(2, 4) | |
it("should return the result of adding the first number to the second", { | |
shouldEqual(6, sum) | |
}) | |
}) | |
}) | |
} |
your example might look like this:
describe("calculator", {
val calculator = Calculator()
describe("adding two numbers", {
val sum = calculator.sum(2, 4)
it("should return the result of adding the first number to the second", {
shouldEqual(6, sum)
})
})
})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like more arbitrary nested
describe("xxx")
withit
. This means no given and on. For instance:or
These examples are from mocha.