document Specs2 + TestKit, see #2068, plus fix up broken includes

- include move of doc samples out of akka package also in the
  includecode directives
- fix broken serialization docs, which require one thing in the akka
  package
This commit is contained in:
Roland 2012-05-24 22:23:36 +02:00
parent 7d342e5c96
commit dd30e81a1a
44 changed files with 681 additions and 555 deletions

View file

@ -0,0 +1,34 @@
package docs.testkit
import org.specs2._
import org.specs2.specification.Scope
import akka.actor.{ Props, ActorSystem, Actor }
import akka.testkit.{ TestKit, ImplicitSender }
class Specs2DemoAcceptance extends Specification {
def is =
"This is a specification of basic TestKit interop" ^
p ^
"A TestKit should" ^
"work properly with Specs2 acceptance tests" ! e1 ^
"correctly convert durations" ! e2
val system = ActorSystem()
implicit def d2d(d: org.specs2.time.Duration): akka.util.FiniteDuration =
akka.util.Duration(d.inMilliseconds, "millis")
def e1 = new TestKit(system) with Scope with ImplicitSender {
within(1 second) {
system.actorOf(Props(new Actor {
def receive = { case x sender ! x }
})) ! "hallo"
expectMsgType[String] must be equalTo "hallo"
}
}
def e2 = ((1 second): akka.util.Duration).toMillis must be equalTo 1000
}