From e18253e6e98e2c72afef1c5f5145bf1e4324b924 Mon Sep 17 00:00:00 2001 From: Michael Xavier Date: Thu, 22 Mar 2012 19:58:18 -0700 Subject: [PATCH] Expose withResponse in yesod-test --- yesod-test/Yesod/Test.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yesod-test/Yesod/Test.hs b/yesod-test/Yesod/Test.hs index 7d1607ec..6d5ba66f 100644 --- a/yesod-test/Yesod/Test.hs +++ b/yesod-test/Yesod/Test.hs @@ -58,7 +58,7 @@ module Yesod.Test ( -- * Utils for building your own assertions -- | Please consider generalizing and contributing the assertions you write. - htmlQuery, parseHTML + htmlQuery, parseHTML, withResponse ) @@ -152,7 +152,8 @@ it label action = do return () ST.put $ SpecsData app conn (specs++spec) --- Performs a given action using the last response. +-- Performs a given action using the last response. Use this to create +-- response-level assertions withResponse :: HoldsResponse a => (SResponse -> ST.StateT a IO b) -> ST.StateT a IO b withResponse f = maybe err f =<< fmap readResponse ST.get where err = failure "There was no response, you should make a request"