For my unit tests I want to setup a database, populate it with base information and run each tests within a session that rollbacks all changes made to the DB in order to always have a pristine copy for each tests.
I’m looking for something like
db withSession {
<create my objects under test>
<run operations>
<run asserts>
this.rollback()
}
The rollback function was in early versions of Scala Query but it seems that it is missing now. How should I implement this functionality?
Best regards
Here is a unit test that illustrates this behaviour
https://github.com/szeiger/scala-query/blob/master/src/test/scala/org/scalaquery/test/TransactionTest.scala
GitHub currently 404s on the link, but I pulled the source code out of the google cache: