trait MonixTaskSpec extends AssertingSyntax
The code has been copied from cats-effect-testing
and fs2
effect test support,
with the difference it provides support for Task instead of IO.
- Self Type
- MonixTaskSpec with AsyncTestSuite
- See also
https://github.com/typelevel/cats-effect-testing https://github.com/typelevel/cats-effect-testing/blob/series/1.x/scalatest/shared/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala https://github.com/functional-streams-for-scala/fs2/blob/188a37883d7bbdf22bc4235a3a1223b14dc10b6c/core/shared/src/test/scala/fs2/EffectTestSupport.scala Provides support for testing Monix Task with scalatest AsyncTestSuite. It provides a set of implicit conversions to convert Task to Future, so the user does not need to do it for every test.
Example
import monix.eval.Task import monix.execution.Scheduler import org.scalatest.funsuite.AsyncFunSuite import org.scalatest.matchers.should.Matchers class DummySpec extends AsyncFunSuite with MonixTaskSpec with Matchers { override implicit def scheduler: Scheduler = Scheduler.io("monix-task-support-spec") test("AsyncTestSuite with Task support") { for { r1 <- Task(2) r2 <- Task(r1 * 3) } yield { r1 shouldBe 2 r2 shouldBe 6 } // we do not have to append `.runToFuture` as we would would using a plain [[AsyncFunSuit]]. } test("AsyncTestSuite with Task and AssertingSyntax support") { Task(2).flatMap(r1 => Task(r1 * 3)).asserting(_ shouldBe 6) }
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- MonixTaskSpec
- AssertingSyntax
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Abstract Value Members
- implicit abstract def scheduler: Scheduler
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- implicit def taskRetrying[T]: Retrying[Task[T]]
- implicit def taskToFutureAssertion(task: Task[Assertion]): Future[Assertion]
- implicit def taskUnitToFutureAssertion(task: Task[Unit]): Future[Assertion]
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()