Removing Specs2 as a dependency to remove the hassle of keeping track of available versions
This commit is contained in:
parent
f7e3c78a7b
commit
743f9cd8ff
5 changed files with 4 additions and 89 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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!
|
||||
}
|
||||
|
|
@ -707,10 +707,3 @@ Some `Specs2 <http://specs2.org>`_ users have contributed examples of how to wor
|
|||
|
||||
* Specifications are by default executed concurrently, which requires some care
|
||||
when writing the tests or alternatively the ``sequential`` keyword.
|
||||
|
||||
You can use the following two examples as guidelines:
|
||||
|
||||
.. includecode:: code/docs/testkit/Specs2DemoSpec.scala
|
||||
|
||||
.. includecode:: code/docs/testkit/Specs2DemoAcceptance.scala
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue