server/tests: tiny refactoring

This commit is contained in:
Sönke Hahn 2016-01-13 19:15:38 +01:00
parent 94dbfd4fde
commit 56c8fbea02

View file

@ -13,6 +13,12 @@ import Test.Hspec.Wai
import Servant
import Servant.Server.UsingConfigSpec.TestCombinators
spec :: Spec
spec = do
spec1
spec2
spec3
-- * API
type OneEntryAPI =
@ -42,8 +48,8 @@ oneEntryTwiceApp = serve (Proxy :: Proxy OneEntryTwiceAPI) config $
-- * tests
spec :: Spec
spec = do
spec1 :: Spec
spec1 = do
describe "accessing config entries from custom combinators" $ do
with (return oneEntryApp) $ do
it "allows retrieving a ConfigEntry" $ do
@ -54,8 +60,6 @@ spec = do
get "/foo" `shouldRespondWith` "\"configEntryTwice\""
get "/bar" `shouldRespondWith` "\"configEntryTwice\""
spec2
type InjectAPI =
InjectIntoConfig :> "untagged" :> ExtractFromConfig :>
Get '[JSON] String :<|>
@ -79,8 +83,6 @@ spec2 = do
it "allows to inject tagged config entries" $ do
get "/tagged" `shouldRespondWith` "\"tagged: injected\""
spec3
type SubConfigAPI =
"foo" :> ExtractFromConfig :> Get '[JSON] String :<|>
SubConfig "sub" '[String] :>