diff options
author | adamw <adam@warski.org> | 2017-07-21 17:04:18 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-21 17:04:18 +0200 |
commit | ec33423b3bc212292768c77c2a7a67715664f4e7 (patch) | |
tree | 3cdcd69bb81cc4a95706706367a446b3b4bc3ead /tests/src/test | |
parent | e5ebd242a4cb982af6b01ec1976ecfc91398189f (diff) | |
download | sttp-ec33423b3bc212292768c77c2a7a67715664f4e7.tar.gz sttp-ec33423b3bc212292768c77c2a7a67715664f4e7.tar.bz2 sttp-ec33423b3bc212292768c77c2a7a67715664f4e7.zip |
Monix handler
Diffstat (limited to 'tests/src/test')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | 3 | ||||
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala index f456fb1..030f90c 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala @@ -17,6 +17,7 @@ import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures} import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} import better.files._ import com.softwaremill.sttp.asynchttpclient.future.FutureAsyncHttpClientHandler +import com.softwaremill.sttp.asynchttpclient.monix.MonixAsyncHttpClientHandler import com.softwaremill.sttp.asynchttpclient.scalaz.ScalazAsyncHttpClientHandler import scala.language.higherKinds @@ -122,6 +123,8 @@ class BasicTests ForceWrappedValue.future) runTests("Async Http Client - Scalaz")(new ScalazAsyncHttpClientHandler(), ForceWrappedValue.scalazTask) + runTests("Async Http Client - Monix")(new MonixAsyncHttpClientHandler(), + ForceWrappedValue.monixTask) def runTests[R[_]](name: String)( implicit handler: SttpHandler[R, Nothing], diff --git a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala index 9114d8b..9bf68bb 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala @@ -9,7 +9,6 @@ import org.scalatest.concurrent.ScalaFutures import scala.concurrent.Future import scala.language.higherKinds -import scalaz.concurrent.Task trait TestHttpServer extends BeforeAndAfterAll with ScalaFutures { this: Suite => @@ -44,10 +43,16 @@ trait ForceWrapped extends ScalaFutures { this: Suite => override def force[T](wrapped: Future[T]): T = wrapped.futureValue } - val scalazTask = new ForceWrappedValue[Task] { - override def force[T](wrapped: Task[T]): T = + val scalazTask = new ForceWrappedValue[scalaz.concurrent.Task] { + override def force[T](wrapped: scalaz.concurrent.Task[T]): T = wrapped.unsafePerformSync } + val monixTask = new ForceWrappedValue[monix.eval.Task] { + import monix.execution.Scheduler.Implicits.global + + override def force[T](wrapped: monix.eval.Task[T]): T = + wrapped.runAsync.futureValue + } } implicit class ForceDecorator[R[_], T](wrapped: R[T]) { def force()(implicit fwv: ForceWrappedValue[R]): T = fwv.force(wrapped) |