hspec-wai-0.11.1: Experimental Hspec support for testing WAI applications

Safe Haskell | Safe-Inferred
Language | Haskell2010

Test.Hspec.Wai.Internal

Synopsis

- type WaiExpectation st = WaiSession st ()
- newtype WaiSession st a = WaiSession {
  - unWaiSession :: ReaderT st Session a
  }
- runWaiSession :: WaiSession () a -> Application -> IO a
- runWithState :: WaiSession st a -> (st, Application) -> IO a
- withApplication :: Application -> WaiSession () a -> IO a
- getApp :: WaiSession st Application
- getState :: WaiSession st st
- formatHeader :: Header -> String

# Documentation

type WaiExpectation st = WaiSession st () Source #

An expectation in the `WaiSession` monad. Failing expectations are communicated through exceptions (similar to `Expectation` and `Assertion`).

newtype WaiSession st a Source #

A WAI test session that carries the `Application` under test and some client state.

Constructors

WaiSession |

Fields

- unWaiSession :: ReaderT st Session a

#### Instances

Instances details

MonadFail (WaiSession st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal Methods fail :: String -> WaiSession st a Source #
MonadIO (WaiSession st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal Methods liftIO :: IO a -> WaiSession st a Source #
Applicative (WaiSession st) Source # |

Instance details

Defined in Test.Hspec.Wai.Internal

Methods

pure :: a -> WaiSession st a Source #

(<*>) :: WaiSession st (a -> b) -> WaiSession st a -> WaiSession st b Source #

liftA2 :: (a -> b -> c) -> WaiSession st a -> WaiSession st b -> WaiSession st c Source #

(*>) :: WaiSession st a -> WaiSession st b -> WaiSession st b Source #

(<*) :: WaiSession st a -> WaiSession st b -> WaiSession st a Source #

Functor (WaiSession st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal Methods fmap :: (a -> b) -> WaiSession st a -> WaiSession st b Source # (<$) :: a -> WaiSession st b -> WaiSession st a Source #
Monad (WaiSession st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal Methods (>>=) :: WaiSession st a -> (a -> WaiSession st b) -> WaiSession st b Source # (>>) :: WaiSession st a -> WaiSession st b -> WaiSession st b Source # return :: a -> WaiSession st a Source #
Example (WaiExpectation st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal Associated Types type Arg (WaiExpectation st) Source # Methods evaluateExample :: WaiExpectation st -> Params -> (ActionWith (Arg (WaiExpectation st)) -> IO ()) -> ProgressCallback -> IO Result Source #
Testable (WaiExpectation st) Source # |
Instance details Defined in Test.Hspec.Wai.QuickCheck Associated Types type State (WaiExpectation st) Source # Methods toProperty :: WaiExpectation st -> WaiProperty (State (WaiExpectation st)) Source #
type Arg (WaiExpectation st) Source # |
Instance details Defined in Test.Hspec.Wai.Internal type Arg (WaiExpectation st) = (st, Application)
type State (WaiExpectation st) Source # |
Instance details Defined in Test.Hspec.Wai.QuickCheck type State (WaiExpectation st) = st

runWaiSession :: WaiSession () a -> Application -> IO a Source #

runWithState :: WaiSession st a -> (st, Application) -> IO a Source #

withApplication :: Application -> WaiSession () a -> IO a Source #

getApp :: WaiSession st Application Source #

getState :: WaiSession st st Source #

formatHeader :: Header -> String Source #