Packages

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, 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
Visibility
  1. Public
  2. All

Type Members

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

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val _db: DB
    Definition Classes
    AutoRollbackLike
  5. def after: Any
    Definition Classes
    AutoRollbackLike → After
  6. def andThen(a: After): After
    Definition Classes
    After
  7. def apply[T](a: ⇒ T)(implicit arg0: AsResult[T]): Result
    Definition Classes
    After → Context
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  10. def compose(a: After): After
    Definition Classes
    After
  11. def db(): DB

    Creates a scalikejdbc.DB instance.

    Creates a scalikejdbc.DB instance.

    returns

    DB instance

    Definition Classes
    AutoRollbackLike
  12. def delayedInit(x: ⇒ Unit): Unit
    Definition Classes
    After → DelayedInit
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. def fixture(implicit session: DBSession): Unit

    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]
    Definition Classes
    LoanPattern
  18. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. implicit val session: DBSession
    Definition Classes
    AutoRollbackLike
  25. def settingsProvider: SettingsProvider
    Attributes
    protected[this]
    Definition Classes
    AutoRollbackLike
  26. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  27. def toString(): String
    Definition Classes
    AnyRef → Any
  28. def using[R <: Closable, A](resource: R)(f: (R) ⇒ A): A
    Definition Classes
    LoanPattern
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @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