on master help sign in
test suite: Capture strips path snippets
commitd9eaf769d158ff941005c621940f62331bba1268 authorSönke Hahn <soenke.hahn@zalora.com> dateTue 28 Oct 2014, 17:52 (12 years ago) parentc98c7db
1 file changed+8
test/Servant/ServerSpec.hs+8
test/Servant/ServerSpec.hs+8
@@ -11,6 +11,7 @@ module Servant.ServerSpec where
1111import Control.Monad.Trans.Either
1212import Data.Aeson
1313import Data.Proxy
14+import Data.String
1415import Data.String.Conversions
1516import GHC.Generics
1617import Network.HTTP.Types
@@ -90,6 +91,13 @@ captureSpec = do
9091 liftIO $ do
9192 decode' (simpleBody response) `shouldBe` Just tweety
9293
94+ with (return (serve
95+ (Proxy :: Proxy (Capture "captured" String :> Raw))
96+ (\ "captured" request respond ->
97+ respond $ responseLBS ok200 [] (cs $ show $ pathInfo request)))) $ do
98+ it "strips the captured path snippet from pathInfo" $ do
99+ get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
100+
93101
94102type GetApi = Get Person
95103getApi :: Proxy GetApi