Permalink
Browse files

Added a useful combinator to FutureMatchers.

  • Loading branch information...
1 parent fa4a8c7 commit 0eda2426cb14c5118d141704d055fc61957e8606 @nuttycom nuttycom committed Jan 20, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 akka_testing/src/main/scala/blueeyes/akka_testing/FutureMatchers.scala
@@ -32,6 +32,8 @@ trait FutureMatchers extends AkkaConversions {
implicit val defaultFutureTimeouts: FutureTimeouts = FutureTimeouts(10, 100L millis)
+ def awaited[A](duration: Duration)(matcher: Matcher[A]) = matcher ^^ { (future: Future[A]) => Await.result(future, duration) }
+
case class whenDelivered[A](matcher: Matcher[A])(implicit timeouts: FutureTimeouts) extends Matcher[Future[A]] with Expectations {
def apply[B <: Future[A]](expectable: Expectable[B]): MatchResult[B] = {
val (ok, okMessage, koMessage) = retry(expectable.evaluate.value, timeouts.retries, timeouts.retries)

0 comments on commit 0eda242

Please sign in to comment.