ZTestLocalFixture

Test-local fixture.

Test-local fixture.

Can be created from raw setup/teardown effects or from ZManaged.

val rawZIOFunFixture = ZTestLocalFixture(options => ZIO.succeed(s"acquired ${options.name}")) { str =>
 putStrLn(s"cleanup [$str]").provideLayer(Console.live)
}

val ZManagedFunFixture = ZTestLocalFixture { options =>
 ZManaged.make(ZIO.succeed(s"acquired ${options.name} with ZManaged")) { str =>
   putStrLn(s"cleanup [$str] with ZManaged").provideLayer(Console.live).orDie
 }
}

rawZIOFunFixture.test("allocate resource with ZIO FunFixture") { str =>
 assertNoDiff(str, "acquired allocate resource with ZIO FunFixture")
}

ZManagedFunFixture.test("allocate resource with ZManaged FunFixture") { str =>
 assertNoDiff(str, "acquired allocate resource with ZManaged FunFixture with ZManaged")
}
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[E, A](setup: TestOptions => IO[E, A])(teardown: A => IO[E, Unit]): FunFixture[A]
def apply[E, A](create: TestOptions => Managed[E, A]): FunFixture[A]