Are there limitations around using annotations for...
# spek
m
Are there limitations around using annotations for Spek test classes? I'm trying to leverage
com.github.trevershick.test.ldap
, which can take an annotation to additionally configure the LDAP instance. This annotation works fine in JUnit (4 and 5) based tests, but appears to break with Spek.
Copy code
@LdapConfiguration(ldifs = arrayOf(Ldif("/hoyluPersonTestSchema.ldif")))
class LdapHandlerSpec : Spek({
    val ldapServer = LdapServerResource(this)
r
can you try using
object
instead of
class
and change
LdapServerResource(this)
to
LdapServerResource(LdapHandlerSpec)
?
m
let me see...
OK, that appears to do the trick.
Can you shed some light into that difference?
And once again, @raniejade, you're a legend
r
Nice,
this
doesn't refer to the spec instance - it refers to the receiver of the top level lambda.
Spec instances doesn't matter in Spek, that's why you can use
object
instead of
class
.
m
I think that's a little more cryptic than I can currently understand... I get that the body of my test suite is a lambda passed into the constructor of Spek... but isn't the receiver of that the LdapServerSpec, which derives from Spek?
r
m
OK. I'll need to poke through that at some saner hour.
For now, much obliged for the pointer and for the help in getting me unstuck.
If you're ever in Seattle, beers (or whatever is your fancy) are on me.
r
No worries, let me know if you have more questions 🙂