Forked from cessationoftime/AkkaSpecification.scala
Last active
August 29, 2015 14:00
-
-
Save mariussoutier/11138244 to your computer and use it in GitHub Desktop.
Test Akka from Specs2, versions as of Play 2.2.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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