Provide Example instance for YesodExample
This commit is contained in:
parent
79db398a54
commit
7fcddb6ee3
@ -1 +1,7 @@
|
|||||||
__1.4.1.1__ Upgrade to hspec 2
|
## 1.4.2
|
||||||
|
|
||||||
|
Provide `Example` instance for `YesodExample`.
|
||||||
|
|
||||||
|
## 1.4.1.1
|
||||||
|
|
||||||
|
Upgrade to hspec 2
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-|
|
{-|
|
||||||
Yesod.Test is a pragmatic framework for testing web applications built
|
Yesod.Test is a pragmatic framework for testing web applications built
|
||||||
using wai and persistent.
|
using wai and persistent.
|
||||||
@ -695,3 +697,20 @@ request reqBuilder = do
|
|||||||
-- Yes, just a shortcut
|
-- Yes, just a shortcut
|
||||||
failure :: (MonadIO a) => T.Text -> a b
|
failure :: (MonadIO a) => T.Text -> a b
|
||||||
failure reason = (liftIO $ HUnit.assertFailure $ T.unpack reason) >> error ""
|
failure reason = (liftIO $ HUnit.assertFailure $ T.unpack reason) >> error ""
|
||||||
|
|
||||||
|
instance YesodDispatch site => Hspec.Example (ST.StateT (YesodExampleData site) IO a) where
|
||||||
|
type Arg (ST.StateT (YesodExampleData site) IO a) = site
|
||||||
|
|
||||||
|
evaluateExample example params action =
|
||||||
|
Hspec.evaluateExample
|
||||||
|
(action $ \site -> do
|
||||||
|
app <- toWaiAppPlain site
|
||||||
|
_ <- ST.evalStateT example YesodExampleData
|
||||||
|
{ yedApp = app
|
||||||
|
, yedSite = site
|
||||||
|
, yedCookies = M.empty
|
||||||
|
, yedResponse = Nothing
|
||||||
|
}
|
||||||
|
return ())
|
||||||
|
params
|
||||||
|
($ ())
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-test
|
name: yesod-test
|
||||||
version: 1.4.1.1
|
version: 1.4.2
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Nubis <nubis@woobiz.com.ar>
|
author: Nubis <nubis@woobiz.com.ar>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user