I have this code:
class AccountSpec extends Specification {
def fakeApp = FakeApplication(additionalConfiguration = inMemoryDatabase())
"Every account" should {
"have a user" in running(fakeApp) {
Account.create("Basic account", "username")
...
etc...
}
}
}
If i try to run this spec I will get an error, because there is no user with a username "username". So what I would like to do is:
def before = { createTestUser() }
i have tried different approaches but havent found a solution yet.
Just extend from this trait org.specs2.mutable.BeforeAfter
, it comes with before and after methods, implement them, here is a link to documentation docs