Wednesday, 4 September 2013

Play2: How to do execute piece of code before each test using specs2

Play2: How to do execute piece of code before each test using specs2

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.

No comments:

Post a Comment