fix specs2 samples so they system.shutdown

This commit is contained in:
Roland 2012-05-25 14:42:22 +02:00
parent dc17bba62f
commit 24f6406634
5 changed files with 22 additions and 15 deletions

View file

@ -1,7 +1,7 @@
package docs.testkit
import org.specs2._
import org.specs2.specification.Scope
import org.specs2.Specification
import org.specs2.specification.{ Step, Scope }
import akka.actor.{ Props, ActorSystem, Actor }
import akka.testkit.{ TestKit, ImplicitSender }
@ -13,10 +13,12 @@ class Specs2DemoAcceptance extends Specification {
p ^
"A TestKit should" ^
"work properly with Specs2 acceptance tests" ! e1 ^
"correctly convert durations" ! e2
"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): akka.util.FiniteDuration =
akka.util.Duration(d.inMilliseconds, "millis")

View file

@ -2,20 +2,19 @@ package docs.testkit
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 akka.util.duration._
class Specs2DemoUnitSpec extends Specification {
class Specs2DemoUnitSpec extends Specification with NoTimeConversions {
val system = ActorSystem()
implicit def d2d(d: org.specs2.time.Duration): akka.util.FiniteDuration =
akka.util.Duration(d.inMilliseconds, "millis")
/*
* this is needed if different test cases would clash when run concurrently,
* e.g. when creating specifically named top-level actors
* e.g. when creating specifically named top-level actors; leave out otherwise
*/
sequential
@ -31,4 +30,6 @@ class Specs2DemoUnitSpec extends Specification {
}
}
}
step(system.shutdown) // do not forget to shutdown!
}