Trait

scalikejdbc.specs2.mutable

AutoRollback

Related Doc: package mutable

Permalink

trait AutoRollback extends After with AutoRollbackLike

Automatic Rollback support for mutable specs2.

If you want to test this Member object,

import scalikejdbc._

object Member {
  def create(id: Long, name: String)(implicit session: DBSession = AutoSession) {
    SQL("insert into members values (?, ?)".bind(id, name).update.apply()
  }
}

Use scalikejdbc.specs2.mutable.AutoRollback like this:

import org.specs2.mutable._
import scalikejdbc.specs2.mutable.AutoRollback

trait DB2AutoRollback extends AutoRollback {
  override def db = NamedDB('db2).toDB
}

object MemberSpec extends Specification {
  "Member should create a new record" in new AutoRollback {
    Member.create(1, "Alice")
    Member.find(1).isDefined must beTrue
  }
  "LegacyAccount should create a new record" in new DB2AutoRollback {
    LegacyAccount.create(2, "Bob")
    LegacyAccount.find(2).isDefined must beTrue
  }
}
Source
AutoRollback.scala
Linear Supertypes
AutoRollbackLike, LoanPattern, After, Scope, DelayedInit, After, Context, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AutoRollback
  2. AutoRollbackLike
  3. LoanPattern
  4. After
  5. Scope
  6. DelayedInit
  7. After
  8. Context
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Closable = AnyRef { def close(): Unit }

    Permalink
    Definition Classes
    LoanPattern

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val _db: DB

    Permalink
    Definition Classes
    AutoRollbackLike
  5. def after: Any

    Permalink
    Definition Classes
    AutoRollbackLike → After
  6. def andThen(a: After): After

    Permalink
    Definition Classes
    After
  7. def apply[T](a: ⇒ T)(implicit arg0: AsResult[T]): Result

    Permalink
    Definition Classes
    After → Context
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def compose(a: After): After

    Permalink
    Definition Classes
    After
  11. def db(): DB

    Permalink

    Creates a scalikejdbc.DB instance.

    Creates a scalikejdbc.DB instance.

    returns

    DB instance

    Definition Classes
    AutoRollbackLike
  12. def delayedInit(x: ⇒ Unit): Unit

    Permalink
    Definition Classes
    After → DelayedInit
  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def fixture(implicit session: DBSession): Unit

    Permalink

    Prepares database for the test.

    Prepares database for the test.

    session

    db session implicitly

    Definition Classes
    AutoRollbackLike
  17. def futureUsing[R <: Closable, A](resource: R)(f: (R) ⇒ Future[A])(implicit ec: ExecutionContext): Future[A]

    Permalink
    Definition Classes
    LoanPattern
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  19. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. implicit val session: DBSession

    Permalink
    Definition Classes
    AutoRollbackLike
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. def using[R <: Closable, A](resource: R)(f: (R) ⇒ A): A

    Permalink
    Definition Classes
    LoanPattern
  28. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AutoRollbackLike

Inherited from LoanPattern

Inherited from After

Inherited from Scope

Inherited from DelayedInit

Inherited from After

Inherited from Context

Inherited from AnyRef

Inherited from Any

Ungrouped