hspec-core-2.11.9: A Testing Framework for Haskell
Stabilityprovisional
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Hspec.Core.Hooks

Contents

Description

 
Synopsis

Types

type Spec = SpecWith () Source #

type SpecWith a = SpecM a () Source #

type ActionWith a = a -> IO () Source #

An IO action that expects an argument of type a

Hooks

before :: IO a -> SpecWith a -> Spec Source #

Run a custom action before every spec item.

before_ :: IO () -> SpecWith a -> SpecWith a Source #

Run a custom action before every spec item.

beforeWith :: (b -> IO a) -> SpecWith a -> SpecWith b Source #

Run a custom action before every spec item.

beforeAll :: HasCallStack => IO a -> SpecWith a -> Spec Source #

Run a custom action before the first spec item.

beforeAll_ :: HasCallStack => IO () -> SpecWith a -> SpecWith a Source #

Run a custom action before the first spec item.

beforeAllWith :: HasCallStack => (b -> IO a) -> SpecWith a -> SpecWith b Source #

Run a custom action with an argument before the first spec item.

after :: ActionWith a -> SpecWith a -> SpecWith a Source #

Run a custom action after every spec item.

after_ :: IO () -> SpecWith a -> SpecWith a Source #

Run a custom action after every spec item.

afterAll :: HasCallStack => ActionWith a -> SpecWith a -> SpecWith a Source #

Run a custom action after the last spec item.

afterAll_ :: HasCallStack => IO () -> SpecWith a -> SpecWith a Source #

Run a custom action after the last spec item.

around :: (ActionWith a -> IO ()) -> SpecWith a -> Spec Source #

Run a custom action before and/or after every spec item.

around_ :: (IO () -> IO ()) -> SpecWith a -> SpecWith a Source #

Run a custom action before and/or after every spec item.

aroundWith :: (ActionWith a -> ActionWith b) -> SpecWith a -> SpecWith b Source #

Run a custom action before and/or after every spec item.

aroundAll :: HasCallStack => (ActionWith a -> IO ()) -> SpecWith a -> Spec Source #

Wrap an action around the given spec.

aroundAll_ :: HasCallStack => (IO () -> IO ()) -> SpecWith a -> SpecWith a Source #

Wrap an action around the given spec.

aroundAllWith :: forall a b. HasCallStack => (ActionWith a -> ActionWith b) -> SpecWith a -> SpecWith b Source #

Wrap an action around the given spec. Changes the arg type inside.

mapSubject :: (b -> a) -> SpecWith a -> SpecWith b Source #

Modify the subject under test.

Note that this resembles a contravariant functor on the first type parameter of SpecM. This is because the subject is passed inwards, as an argument to the spec item.

ignoreSubject :: SpecWith () -> SpecWith a Source #

Ignore the subject under test for a given spec.