Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Adds a slightly richer example to the suite local fixture
  • Loading branch information
mtomko authored May 24, 2023
1 parent e6c0c8c commit 908d589
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,21 @@ MUnit supports reusable suite-local fixtures that are instantiated only once for

```scala
import cats.effect.{IO, Resource}
import fs2.io.file.Files

class SuiteLocalExampleSuite extends CatsEffectSuite {

val myFixture = ResourceSuiteLocalFixture(
"my-fixture",
Resource.make(IO.unit)(_ => IO.unit)
Files[IO].tempFile
)

val tempFileFixture = ResourceSuitLocalFixture(
"temp-file",
Files[IO].tempFile
)

override def munitFixtures = List(myFixture)
override def munitFixtures = List(myFixture, tempFileFixture)

test("first test") {
IO(myFixture()).assertEquals(())
Expand All @@ -127,6 +133,12 @@ class SuiteLocalExampleSuite extends CatsEffectSuite {
test("second test") {
IO(myFixture()).assertEquals(())
}

test("third test") {
IO(tempFileFixture()).flatMap { file =>
assertIO(Files[IO].exists(file), true)
}
}

}
```
Expand Down

0 comments on commit 908d589

Please sign in to comment.