diff --git a/scalatest/shared/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala b/scalatest/shared/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala index 6c8e948..509a3e1 100644 --- a/scalatest/shared/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala +++ b/scalatest/shared/src/main/scala/cats/effect/testing/scalatest/AsyncIOSpec.scala @@ -16,8 +16,12 @@ package cats.effect.testing.scalatest +import cats.effect.IO import cats.effect.unsafe.{IORuntime, IORuntimeConfig} +import org.scalactic.source.Position import org.scalatest.AsyncTestSuite +import org.scalatest.enablers.Retrying +import org.scalatest.time.Span trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport { asyncTestSuite: AsyncTestSuite => @@ -26,4 +30,11 @@ trait AsyncIOSpec extends AssertingSyntax with EffectTestSupport { asyncTestSuit IORuntime(executionContext, executionContext, scheduler, sd, IORuntimeConfig()) } + + 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())), + ) + } }