arve
12/23/2018, 11:39 PMfun testSpec(setupFn: () -> Greeter): AbstractFreeSpec.() -> Unit {
val greeter = setupFn()
return {
"Test hello world" {
greeter.sayHi() shouldBe "Hi"
}
}
}
class GreeterServiceTest : StringSpec(testSpec {
val db = Database.createInMemoryDb()
val service = GreeterSimulator(db)
db.seed("classpath:db/seed/greets")
service
})
class MySimulatorTest : StringSpec(testSpec {
GreeterSimulator()
})
Is there a more elegant ways of parameterising the SUT of a spec?