witoldsz
06/26/2017, 12:34 PMraniejade
06/26/2017, 12:38 PMwitoldsz
06/26/2017, 12:38 PMwitoldsz
06/26/2017, 12:41 PMobject ForexRatesSpec: Spek({
describe("ForexRates") {
val mq = FakeMQ3()
val setup = EnvSetup(mq, Config(…))
val clock = ClockStub()
val jooq = setup.jooq
val txm = setup.ultm.txManager
val db = MarketHistoryDatabase(jooq)
beforeGroup {
mq.connect()
}
beforeEachTest {
txm.tx { jooq.truncate(FX_HISTORY).execute() }
clock.setTime("2017-06-23T12:04:35.500Z")
}
on("first call") {
…
}
on("subsequent calls") {
…
}
}
})
witoldsz
06/26/2017, 12:42 PMbefore…
then I will have much more typing: `val`s become `var`s etc…raniejade
06/26/2017, 12:43 PMraniejade
06/26/2017, 12:43 PMval mq by memoized { FakeMQ3() }
witoldsz
06/26/2017, 12:44 PMraniejade
06/26/2017, 12:44 PMraniejade
06/26/2017, 12:45 PMval mq by memoized(CachingMode.TEST) { FakeMQ3() }
raniejade
06/26/2017, 12:45 PMCachingMode.TEST
is the default valueraniejade
06/26/2017, 12:45 PMGROUP
and SCOPE
are supported as wellwitoldsz
06/26/2017, 12:45 PMwitoldsz
06/26/2017, 12:50 PMraniejade
06/26/2017, 12:51 PMwitoldsz
06/26/2017, 12:52 PMwitoldsz
06/26/2017, 12:52 PMmemoized
raniejade
06/26/2017, 12:52 PMval mq = FakeMQ3()
witoldsz
06/26/2017, 12:53 PMraniejade
06/26/2017, 12:54 PMdescribe
, context
, etcc..) lambda is executed once.witoldsz
06/26/2017, 12:55 PMraniejade
06/26/2017, 12:55 PMwitoldsz
06/26/2017, 12:57 PMraniejade
06/26/2017, 12:58 PMvar
and setting them up in a beforeEachTest
.witoldsz
06/26/2017, 12:59 PMraniejade
06/26/2017, 12:59 PMraniejade
06/26/2017, 1:00 PM!!
witoldsz
06/26/2017, 1:00 PMraniejade
06/26/2017, 1:00 PMlateinit
is not supported locallyjk
06/26/2017, 1:00 PMvar mq: FakeMQ3? = null
and setup with @Before
?witoldsz
06/26/2017, 1:01 PMwitoldsz
06/26/2017, 1:01 PMwitoldsz
06/26/2017, 1:17 PMraniejade
06/26/2017, 1:38 PMobject
to declare a spek. As you can also see, everything is setup-d using lambda blocks, no class instances there only local variables.raniejade
06/26/2017, 1:41 PMwitoldsz
06/26/2017, 4:15 PM