scalikejdbc.specs2.mutable

AutoRollback

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
  }
}
Linear Supertypes
AutoRollbackLike, LoanPattern, After, DelayedInit, After, Context, Scope, Scope, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. AutoRollback
  2. AutoRollbackLike
  3. LoanPattern
  4. After
  5. DelayedInit
  6. After
  7. Context
  8. Scope
  9. Scope
  10. AnyRef
  11. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

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

    Definition Classes
    LoanPattern

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val _db: DB

    Definition Classes
    AutoRollbackLike
  7. def after: Any

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

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

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

    Definition Classes
    Any
  11. def clone(): AnyRef

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

    Definition Classes
    After
  13. def db(): DB

    Creates a scalikejdbc.DB instance.

    Creates a scalikejdbc.DB instance.

    returns

    DB instance

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

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

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

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

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

    Prepares database for the test.

    Prepares database for the test.

    session

    db session implicitly

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

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

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

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

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

    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. implicit val session: DBSession

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

    Definition Classes
    AnyRef
  28. def toString(): String

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

    Definition Classes
    LoanPattern
  30. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AutoRollbackLike

Inherited from LoanPattern

Inherited from After

Inherited from DelayedInit

Inherited from After

Inherited from Context

Inherited from Scope

Inherited from Scope

Inherited from AnyRef

Inherited from Any

Ungrouped