hspec-contrib-0.5.2: Contributed functionality for Hspec
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Hspec.Contrib.Mocks.V1

Synopsis

Documentation

stubAction :: HasCallStack => [a] -> IO (IO a) Source #

Create a test stub action.

>>> stub <- stubAction ["foo", "bar", "baz"]
>>> stub
"foo"
>>> stub
"bar"
>>> stub
"baz"
>>> stub
*** Exception: HUnitFailure ...stubAction: no values left...

Since: 0.5.2

withSpy :: ((a -> IO ()) -> IO ()) -> IO [a] Source #

Create a test spy action.

Record any arguments that are passed to that action.

>>> withSpy $ \ spy -> spy "foo" >> spy "bar" >> spy "baz"
["foo","bar","baz"]

Since: 0.5.2