AutoRollback
AutoRollback for ScalaTest
import org.scalatest.flatspec.FixtureAnyFlatSpec
class MemberSpec extends FixtureAnyFlatSpec with AutoRollback {
describe of "Member"
it should "create a new record" in { implicit session =>
Member.create(1, "Alice")
Member.find(1).isDefined should be(true)
}
}
class LegacyAccountSpec extends FlatSpec with AutoRollback {
override def db() = NamedDB('db2).toDB
override def fixture(implicit session: DBSession) {
SQL("insert into legacy_accounts values ...").update.apply()
}
it should "create a new record" in { implicit session =>
LegacyAccount.create(2, "Bob")
LegacyAccount.find(2).isDefined should be(true)
}
}
trait LoanPattern
class Object
trait Matchable
class Any
Type members
Types
Inherited types
Value members
Concrete methods
Prepares database for the test.
Prepares database for the test.
- Value Params
- session
db session implicitly
Inherited methods
def futureUsing[R <: Closable, A](resource: R)(f: R => Future[A])(implicit ec: ExecutionContext): Future[A]
Guarantees a Closeable resource will be closed after being passed to a block that takes the resource as a parameter and returns a Future.
Guarantees a Closeable resource will be closed after being passed to a block that takes the resource as a parameter and returns a Future.
- Inherited from
- LoanPattern