October 2018
Intermediate to advanced
370 pages
9h 15m
English
This style differs from the previous one by using the describe block. The describe block is also used to define a context but we can also nest one describe block into another to provide a more detailed context. Let's create the DescribeStyleToDoSpek object to demonstrate this. Initially, it may look as follows:
@RunWith(JUnitPlatform::class)object DescribeStyleToDoSpek : Spek({ describe("a storage") { val storage = ToDoStorage() on("set a todo with with args: name and context") { val todo = ToDo("name", "content") val result = storage.set("name", todo) it("returns true") { assert(result) } } on("""get a todo by "name" key""") { val todo = storage["name"] it("""returns a todo with "content" """) { assertEquals(
Read now
Unlock full access