From 5aa0e2e73390d98714fd13ebbfdee3ab16c7995f Mon Sep 17 00:00:00 2001 From: Nickolay Kudasov Date: Thu, 24 Sep 2015 14:02:21 +0300 Subject: [PATCH] Fix servant-docs test suite and add Headers to TestApi --- servant-docs/test/Servant/DocsSpec.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/servant-docs/test/Servant/DocsSpec.hs b/servant-docs/test/Servant/DocsSpec.hs index a294c3b1..5375b0c3 100644 --- a/servant-docs/test/Servant/DocsSpec.hs +++ b/servant-docs/test/Servant/DocsSpec.hs @@ -30,7 +30,7 @@ spec = describe "Servant.Docs" $ do describe "markdown with extra info" $ do let extra = extraInfo - (Proxy :: Proxy (Get '[JSON, PlainText] Int)) + (Proxy :: Proxy (Get '[JSON, PlainText] (Headers '[Header "Location" String] Int))) (defAction & notes <>~ [DocNote "Get an Integer" ["get an integer in Json or plain text"]]) <> extraInfo @@ -90,26 +90,26 @@ data Datatype1 = Datatype1 { dt1field1 :: String instance ToJSON Datatype1 -instance ToSample Datatype1 Datatype1 where +instance ToSample Datatype1 where toSamples _ = singleSample $ Datatype1 "field 1" 13 -instance ToSample Char Char where +instance ToSample Char where toSamples _ = samples ['a'..'z'] -instance ToSample Int Int where +instance ToSample Int where toSamples _ = singleSample 17 instance MimeRender PlainText Int where mimeRender _ = cs . show -type TestApi1 = Get '[JSON, PlainText] Int +type TestApi1 = Get '[JSON, PlainText] (Headers '[Header "Location" String] Int) :<|> ReqBody '[JSON] String :> Post '[JSON] Datatype1 data TT = TT1 | TT2 deriving (Show, Eq) data UT = UT1 | UT2 deriving (Show, Eq) -instance ToSample TT TT where +instance ToSample TT where toSamples _ = [("eins", TT1), ("zwei", TT2)] -instance ToSample UT UT where +instance ToSample UT where toSamples _ = [("yks", UT1), ("kaks", UT2)]