Last active
February 22, 2017 22:15
-
-
Save marcospereira/fc47ab111f26b7594668864842866acc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ResetDbSpec extends PlaySpec with BeforeAndAfterAll { | |
private def withTestDatabase[T](block: Database => T) = { | |
Databases.withDatabase( | |
driver = "com.mysql.jdbc.Driver", | |
url = "jdbc:mysql://localhost/test", | |
name = "mydatabase", | |
config = Map( | |
"user" -> "test", | |
"password" -> "secret" | |
) | |
)(block) | |
} | |
override def beforeAll() = { | |
withTestDatabase { database => | |
Evolutions.applyEvolutions(database) | |
} | |
} | |
override def afterAll() = { | |
withTestDatabase { database => | |
Evolutions.cleanupEvolutions(database) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment