79471958

Date: 2025-02-27 08:13:04
Score: 0.5
Natty:
Report link

Seems that it was probably my understanding of cats-effect Resource (or cats-effect in general) that was lacking.

moving the .allocated.unsafeRunSync()._1 to an object in Test and using that in the test classes worked.

import cats.effect.unsafe.implicits.global

object TransactorProvider {
  lazy val transactor = DatabaseConfig.transactor.allocated.unsafeRunSync()._1
}
class DAOTest1 extends AsyncFlatSpec with AsyncIOSpec with IOChecker {

  def transactor = TransactorProvider.transactor
...
...
...
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Björn Pedersen