hspec-wai 0.4.0 → 0.4.1
raw patch · 3 files changed
+11/−4 lines, 3 filesdep ~aeson-qqPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson-qq
API changes (from Hackage documentation)
Files
- hspec-wai.cabal +2/−2
- src/Test/Hspec/Wai/Matcher.hs +3/−2
- src/Test/Hspec/Wai/Util.hs +6/−0
hspec-wai.cabal view
@@ -1,5 +1,5 @@ name: hspec-wai-version: 0.4.0+version: 0.4.1 license: MIT license-file: LICENSE copyright: (c) 2012-2014 Fujimura Daisuke,@@ -40,7 +40,7 @@ , hspec2 , template-haskell , aeson- , aeson-qq >= 0.7.2+ , aeson-qq >= 0.7.3 test-suite spec type:
src/Test/Hspec/Wai/Matcher.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ViewPatterns #-} module Test.Hspec.Wai.Matcher ( ResponseMatcher(..) , match@@ -39,9 +40,9 @@ , expectedBody >>= matchBody_ body ] where- matchBody_ actual expected = actualExpected "body mismatch:" actual_ expected_ <$ guard (actual /= expected)+ matchBody_ (toStrict -> actual) (toStrict -> expected) = actualExpected "body mismatch:" actual_ expected_ <$ guard (actual /= expected) where- (actual_, expected_) = case (safeToString $ LB.toStrict actual, safeToString $ LB.toStrict expected) of+ (actual_, expected_) = case (safeToString actual, safeToString expected) of (Just x, Just y) -> (x, y) _ -> (show actual, show expected)
src/Test/Hspec/Wai/Util.hs view
@@ -2,10 +2,12 @@ module Test.Hspec.Wai.Util where import Control.Monad+import Data.Monoid import Data.Maybe import Data.Char import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as B+import qualified Data.ByteString.Lazy as LB import qualified Data.Text as T import qualified Data.Text.Encoding as T import qualified Data.CaseInsensitive as CI@@ -21,3 +23,7 @@ [] -> True _ -> isSpace (last str) || any (not . isPrint) str guard isSafe >> return str++-- for compatibility with older versions of `bytestring`+toStrict :: LB.ByteString -> ByteString+toStrict = mconcat . LB.toChunks