natpryce
12/08/2018, 9:24 PMfun Context<Unit, Approver>.approvingYaml() {
fixtureInstrumented { test ->
Approver(
test.fullName().joinToString("/"),
FileSystemSourceOfApproval(
File("src/test/resources"),
Reporters.fileSystemReporter())
.withTypeExtension(".yml"),
Formatter(yaml::writeValueAsString),
Serializers.stringSerializer(),
Checkers.stringChecker()
)
}
}
fun TestContext<Approver>.approve(name: String, fn: () -> Any) {
test(name) {
assertApproved(fn())
}
}
Used like:
val `a context` = context<Approver> {
approvingYaml()
approve("an approval test") {
TheThingToBeApproved(andSomeArguments)
}
}