packages feed

hspec-snap 0.3.2.7 → 0.3.2.8

raw patch · 2 files changed

+32/−2 lines, 2 filesdep ~hspec-snapPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec-snap

API changes (from Hackage documentation)

Files

hspec-snap.cabal view
@@ -1,5 +1,5 @@ name:                hspec-snap-version:             0.3.2.7+version:             0.3.2.8 synopsis:            A library for testing with Hspec and the Snap Web Framework homepage:            https://github.com/dbp/hspec-snap license:             BSD3@@ -38,6 +38,7 @@   type:            exitcode-stdio-1.0   hs-source-dirs:  spec   main-is:         Main.hs+  other-modules: Utils   build-depends:   base                     >= 4.6      && < 4.9                  , aeson                    >= 0.6      && < 0.8.1                  , bytestring               >= 0.9      && < 0.11@@ -54,4 +55,4 @@                  , text                     >= 0.11     && < 1.3                  , transformers             >= 0.3      && < 0.5                  , directory                >= 1.2      && < 1.3-  build-depends:   hspec-snap               == 0.3.2.6+  build-depends:   hspec-snap               == 0.3.2.7
+ spec/Utils.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE OverloadedStrings         #-}++{-|+Module      : Utils+Description : Helpers for testing++Currently just copypasta from snap-extras to avoid dependency conflicts+-}+module Utils where++import           Data.Aeson      (encode, ToJSON)++import           Snap.Core       (modifyResponse, setHeader, writeLBS+                                 ,MonadSnap)+++-------------------------------------------------------------------------------+-- | Set MIME to 'application/json' and write given object into+-- 'Response' body.+writeJSON :: (MonadSnap m, ToJSON a) => a -> m ()+writeJSON a = do+  jsonResponse+  writeLBS . encode $ a+++-------------------------------------------------------------------------------+-- | Mark response as 'application/json'+jsonResponse :: MonadSnap m => m ()+jsonResponse = modifyResponse $ setHeader "Content-Type" "application/json"