Updated according to review
This commit is contained in:
parent
a8f5418b22
commit
0aa1765b6c
@ -1,3 +1,7 @@
|
|||||||
|
## 1.6.4
|
||||||
|
Add yesodSpecWithSiteGeneratorAndArgument
|
||||||
|
[#1485](https://github.com/yesodweb/yesod/pull/1485)
|
||||||
|
|
||||||
## 1.6.3
|
## 1.6.3
|
||||||
Add performMethod
|
Add performMethod
|
||||||
[#1502](https://github.com/yesodweb/yesod/pull/1502)
|
[#1502](https://github.com/yesodweb/yesod/pull/1502)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ module Yesod.Test
|
|||||||
yesodSpec
|
yesodSpec
|
||||||
, YesodSpec
|
, YesodSpec
|
||||||
, yesodSpecWithSiteGenerator
|
, yesodSpecWithSiteGenerator
|
||||||
, yesodSpecWithSiteGenerator'
|
, yesodSpecWithSiteGeneratorAndArgument
|
||||||
, yesodSpecApp
|
, yesodSpecApp
|
||||||
, YesodExample
|
, YesodExample
|
||||||
, YesodExampleData(..)
|
, YesodExampleData(..)
|
||||||
@ -275,32 +275,25 @@ yesodSpecWithSiteGenerator :: YesodDispatch site
|
|||||||
=> IO site
|
=> IO site
|
||||||
-> YesodSpec site
|
-> YesodSpec site
|
||||||
-> Hspec.Spec
|
-> Hspec.Spec
|
||||||
yesodSpecWithSiteGenerator getSiteAction yspecs =
|
yesodSpecWithSiteGenerator getSiteAction =
|
||||||
Hspec.fromSpecList $ map (unYesod getSiteAction) $ execWriter yspecs
|
yesodSpecWithSiteGeneratorAndArgument (const getSiteAction)
|
||||||
where
|
|
||||||
unYesod getSiteAction' (YesodSpecGroup x y) = Hspec.specGroup x $ map (unYesod getSiteAction') y
|
|
||||||
unYesod getSiteAction' (YesodSpecItem x y) = Hspec.specItem x $ do
|
|
||||||
site <- getSiteAction'
|
|
||||||
app <- toWaiAppPlain site
|
|
||||||
evalSIO y YesodExampleData
|
|
||||||
{ yedApp = app
|
|
||||||
, yedSite = site
|
|
||||||
, yedCookies = M.empty
|
|
||||||
, yedResponse = Nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
yesodSpecWithSiteGenerator' :: YesodDispatch site
|
-- | Same as yesodSpecWithSiteGenerator, but also takes an argument to build the site
|
||||||
|
-- and makes that argument available to the tests.
|
||||||
|
--
|
||||||
|
-- @since 1.6.4
|
||||||
|
yesodSpecWithSiteGeneratorAndArgument :: YesodDispatch site
|
||||||
=> (a -> IO site)
|
=> (a -> IO site)
|
||||||
-> YesodSpec site
|
-> YesodSpec site
|
||||||
-> Hspec.SpecWith a
|
-> Hspec.SpecWith a
|
||||||
yesodSpecWithSiteGenerator' getSiteAction yspecs =
|
yesodSpecWithSiteGeneratorAndArgument getSiteAction yspecs =
|
||||||
Hspec.fromSpecList $ map (unYesod getSiteAction) $ execWriter yspecs
|
Hspec.fromSpecList $ map (unYesod getSiteAction) $ execWriter yspecs
|
||||||
where
|
where
|
||||||
unYesod getSiteAction' (YesodSpecGroup x y) = Hspec.specGroup x $ map (unYesod getSiteAction') y
|
unYesod getSiteAction' (YesodSpecGroup x y) = Hspec.specGroup x $ map (unYesod getSiteAction') y
|
||||||
unYesod getSiteAction' (YesodSpecItem x y) = Hspec.specItem x $ \a -> do
|
unYesod getSiteAction' (YesodSpecItem x y) = Hspec.specItem x $ \a -> do
|
||||||
site <- getSiteAction' a
|
site <- getSiteAction' a
|
||||||
app <- toWaiAppPlain site
|
app <- toWaiAppPlain site
|
||||||
ST.evalStateT y YesodExampleData
|
evalSIO y YesodExampleData
|
||||||
{ yedApp = app
|
{ yedApp = app
|
||||||
, yedSite = site
|
, yedSite = site
|
||||||
, yedCookies = M.empty
|
, yedCookies = M.empty
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-test
|
name: yesod-test
|
||||||
version: 1.6.3
|
version: 1.6.4
|
||||||
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