Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Test Akka from Specs2, versions as of Play 2.2.x
import org.specs2.mutable._
import org.specs2.specification._
import org.specs2.matcher._
import org.specs2.execute._
import org.specs2.control.Debug
import org.specs2.main.ArgumentsShortcuts
import akka.testkit.TestKitBase
import akka.actor.ActorSystem
trait AkkaSpecification extends SpecificationStructure
with org.specs2.mutable.FragmentsBuilder
with org.specs2.mutable.SpecificationInclusion
with ArgumentsArgs
with ArgumentsShortcuts
with MustMatchers
with StandardResults
with StandardMatchResults
with Contexts
with TestKitBase {
def is = specFragments
implicit lazy val system = ActorSystem()
/** transform a context to a result to allow the implicit passing of a context to each example */
implicit def contextToResult[T](t: MatchResult[T])(implicit context: Context = defaultContext): Result = context(asResult(t))
/** use an available outside context to transform a function returning a MatchResult into a result */
implicit def outsideFunctionToResult[T, S](implicit o: Outside[T]) = (f: T => MatchResult[S]) => { o((t1: T) => f(t1).toResult) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment