In a framework like Spek, are all mocks (e.g. with...
# spek
v
In a framework like Spek, are all mocks (e.g. with mockk) initialized all at once, on start up? I would have hoped that mocks were scoped to their corresponding
describe
or
it
blocks. As it is, even if I run a single
it
block test in Intellij, all the mocks across all blocks are being initialized. Is this a consequence of putting the entire test suite into the constructor of my test class (which seems bonkers to me)?
I've achieved the result I want with some
beforeEachTest
blocks.
r
m
you can use
val myMock by memoized {mock(Something::class.java)}
but you should check the docs in 1st place to understand how SPEK engine works