Skip to content

Commit

Permalink
Merge pull request #293 from mtomko/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
danicheg authored Aug 21, 2023
2 parents e7029d0 + 937812b commit d4453f3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion 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)
)

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 =>
Files[IO].exists(file).assert
}
}

}
```
Expand Down

0 comments on commit d4453f3

Please sign in to comment.