Last active
June 4, 2020 11:41
-
-
Save dariathecracker/d774ec7d721ebeb354a7c42ad44cc7ab to your computer and use it in GitHub Desktop.
Boilerplate machinery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zio.test.mock.{Method, Mock, Mockable} | |
object MockConsole { | |
// ... | |
object putStr extends Method[MockConsole, String, Unit] | |
object putStrLn extends Method[MockConsole, String, Unit] | |
object getStrLn extends Method[MockConsole, Unit, String] | |
implicit val mockable: Mockable[MockConsole] = (mock: Mock) => | |
new MockConsole { | |
val console = new Service[Any] { | |
def putStr(line: String): UIO[Unit] = mock(Service.putStr, line) | |
def putStrLn(line: String): UIO[Unit] = mock(Service.putStrLn, line) | |
val getStrLn: IO[IOException, String] = mock(Service.getStrLn) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment