diff --git a/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala b/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala index 7f88449b..f1eb819f 100644 --- a/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala +++ b/scalatest/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala @@ -17,7 +17,10 @@ package cats.effect.testing.scalatest import cats.effect.{ContextShift, IO, Timer} +import org.scalactic.source.Position import org.scalatest.AsyncTestSuite +import org.scalatest.enablers.Retrying +import org.scalatest.time.Span import scala.concurrent.ExecutionContext @@ -25,4 +28,11 @@ trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport { asyncTestSuit override val executionContext: ExecutionContext = ExecutionContext.global implicit val ioContextShift: ContextShift[IO] = IO.contextShift(executionContext) implicit val ioTimer: Timer[IO] = IO.timer(executionContext) + + implicit def ioRetrying[T]: Retrying[IO[T]] = new Retrying[IO[T]] { + override def retry(timeout: Span, interval: Span, pos: Position)(fun: => IO[T]): IO[T] = + IO.fromFuture( + IO(Retrying.retryingNatureOfFutureT[T](executionContext).retry(timeout, interval, pos)(fun.unsafeToFuture())), + ) + } }