yesod-test 1.2.1.4 → 1.2.1.5
raw patch · 3 files changed
+24/−2 lines, 3 files
Files
- Yesod/Test.hs +3/−1
- test/main.hs +20/−0
- yesod-test.cabal +1/−1
Yesod/Test.hs view
@@ -539,7 +539,9 @@ , rbdGets = [] , rbdHeaders = [] }- let path = TE.decodeUtf8 $ Builder.toByteString $ H.encodePathSegments rbdPath+ let path+ | null rbdPath = "/"+ | otherwise = TE.decodeUtf8 $ Builder.toByteString $ H.encodePathSegments rbdPath -- expire cookies and filter them for the current path. TODO: support max age currentUtc <- liftIO getCurrentTime
test/main.hs view
@@ -15,6 +15,7 @@ import Data.Monoid ((<>)) import Control.Applicative import Network.Wai (pathInfo)+import Data.Maybe (fromMaybe) import Data.ByteString.Lazy.Char8 () import qualified Data.Map as Map@@ -122,6 +123,16 @@ get ("/dynamic2/שלום" :: Text) statusIs 200 bodyEquals "שלום"+ describe "cookies" $ yesodSpec cookieApp $ do+ yit "should send the cookie #730" $ do+ get ("/" :: Text)+ statusIs 200+ post ("/cookie/foo" :: Text)+ statusIs 302+ get ("/" :: Text)+ statusIs 200+ printBody+ bodyContains "Foo" instance RenderMessage LiteApp FormMessage where renderMessage _ _ = defaultFormMessage@@ -151,3 +162,12 @@ case mfoo of FormSuccess (foo, _) -> return $ toHtml foo _ -> defaultLayout widget++cookieApp :: LiteApp+cookieApp = liteApp $ do+ dispatchTo $ fromMaybe "no message available" <$> getMessage+ onStatic "cookie" $ do+ onStatic "foo" $ dispatchTo $ do+ setMessage "Foo"+ redirect ("/cookie/home" :: Text)+ return ()
yesod-test.cabal view
@@ -1,5 +1,5 @@ name: yesod-test-version: 1.2.1.4+version: 1.2.1.5 license: MIT license-file: LICENSE author: Nubis <nubis@woobiz.com.ar>