mike-neck/ktcheck

Divide Before and After callbacks from Given

mike-neck opened this issue · 0 comments

DIvide Given<C,G> into

  • Given<C, G>
  • Before<C>
  • After<C>

with methods

interface BeforeCallback<C, G> {
  infix operator fun plus(given: Given<C, G>): Given<C,G>
}

interface Given<C,G> {
  infix operator fun plus(after: After<C>): Given<C, G>
}

and make dsl like

object ExampleSpec: KtCheck
by Before<C>({ C() }) +
  Given<C, G>({ makeG() })
  .When<C,G,W>({ makeW(it) })
  .Then<C,G,W>({ _, r -> r shouldBe something() }) +
  After<C>({ tearDown() })