aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-09-04 17:23:26 +0200
committeradamw <adam@warski.org>2017-09-04 17:23:26 +0200
commitfebcdbcb4448fe1e754ecd08fb4df4bf6c6a211c (patch)
tree2538bdcaa15862b13625305ba82c3c99a25fc753
parentba60425c0033b3f374a7e75a0465d022811fb94e (diff)
downloadsttp-febcdbcb4448fe1e754ecd08fb4df4bf6c6a211c.tar.gz
sttp-febcdbcb4448fe1e754ecd08fb4df4bf6c6a211c.tar.bz2
sttp-febcdbcb4448fe1e754ecd08fb4df4bf6c6a211c.zip
Hopefully fixing a flaky test
-rw-r--r--tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
index 407aaca..6292ecd 100644
--- a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
+++ b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
@@ -7,7 +7,7 @@ import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Route
import akka.stream.ActorMaterializer
-import org.scalatest.concurrent.ScalaFutures
+import org.scalatest.concurrent.{PatienceConfiguration, ScalaFutures}
import org.scalatest.exceptions.TestFailedException
import org.scalatest.matchers.{MatchResult, Matcher}
import org.scalatest.{BeforeAndAfterAll, Suite}
@@ -17,7 +17,7 @@ import scala.concurrent.duration._
import scala.language.higherKinds
import scalaz._
-trait TestHttpServer extends BeforeAndAfterAll with ScalaFutures {
+trait TestHttpServer extends BeforeAndAfterAll with ScalaFutures with TestingPatience {
this: Suite =>
protected implicit val actorSystem: ActorSystem = ActorSystem("sttp-test")
import actorSystem.dispatcher
@@ -41,9 +41,7 @@ trait ForceWrappedValue[R[_]] {
def force[T](wrapped: R[T]): T
}
-object ForceWrappedValue extends ScalaFutures {
- override implicit val patienceConfig: PatienceConfig =
- PatienceConfig(timeout = 5.seconds, interval = 150.milliseconds)
+object ForceWrappedValue extends ScalaFutures with TestingPatience {
val id = new ForceWrappedValue[Id] {
override def force[T](wrapped: Id[T]): T =
@@ -81,7 +79,7 @@ object ForceWrappedValue extends ScalaFutures {
}
}
-trait ForceWrapped extends ScalaFutures { this: Suite =>
+trait ForceWrapped extends ScalaFutures with TestingPatience { this: Suite =>
type ForceWrappedValue[R[_]] = com.softwaremill.sttp.ForceWrappedValue[R]
val ForceWrappedValue: com.softwaremill.sttp.ForceWrappedValue.type =
com.softwaremill.sttp.ForceWrappedValue
@@ -116,3 +114,8 @@ object CustomMatchers {
def haveSameContentAs(file: io.File) = new FileContentsMatch(file)
}
+
+trait TestingPatience extends PatienceConfiguration {
+ override implicit val patienceConfig: PatienceConfig =
+ PatienceConfig(timeout = 5.seconds, interval = 150.milliseconds)
+}