Removing Specs2 as a dependency to remove the hassle of keeping track of available versions

This commit is contained in:
Viktor Klang 2012-07-21 18:09:20 +02:00
parent f7e3c78a7b
commit 743f9cd8ff
5 changed files with 4 additions and 89 deletions

View file

@ -1,39 +0,0 @@
package docs.testkit
import language.postfixOps
import language.implicitConversions
import org.specs2.Specification
import org.specs2.specification.{ Step, Scope }
import akka.actor.{ Props, ActorSystem, Actor }
import akka.testkit.{ TestKit, ImplicitSender }
import scala.concurrent.util.{ FiniteDuration, Duration }
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 ^
Step(system.shutdown()) ^ end // do not forget to shutdown!
val system = ActorSystem()
// an alternative to mixing in NoTimeConversions
implicit def d2d(d: org.specs2.time.Duration): FiniteDuration = 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): Duration).toMillis must be equalTo 1000
}

View file

@ -1,37 +0,0 @@
package docs.testkit
import language.postfixOps
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
import org.specs2.time.NoTimeConversions
import akka.actor.{ Props, ActorSystem, Actor }
import akka.testkit.{ TestKit, ImplicitSender }
import scala.concurrent.util.duration._
class Specs2DemoUnitSpec extends Specification with NoTimeConversions {
val system = ActorSystem()
/*
* this is needed if different test cases would clash when run concurrently,
* e.g. when creating specifically named top-level actors; leave out otherwise
*/
sequential
"A TestKit" should {
"work properly with Specs2 unit tests" in
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"
}
}
}
step(system.shutdown) // do not forget to shutdown!
}