Merge pull request #138 from jcristovao/patch-1

order does not work
This commit is contained in:
Joe Nelson
2015-02-12 08:41:40 -08:00
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ orderParse q =
orderParseTerm :: Text -> Maybe OrderTerm
orderParseTerm s =
case split (=='.') s of
[d,c] ->
[c,d] ->
if d `elem` ["asc", "desc"]
then Just $ OrderTerm c $
if d == "asc" then "asc" else "desc"
+2 -2
View File
@@ -25,14 +25,14 @@ spec = beforeAll (clearTable "items" >> createItems 15)
describe "ordering response" $ do
it "by a column asc" $
get "/items?id=lte.2&order=asc.id"
get "/items?id=lte.2&order=id.asc"
`shouldRespondWith` ResponseMatcher {
matchBody = Just "[{\"id\":1},{\"id\":2}]"
, matchStatus = 200
, matchHeaders = ["Content-Range" <:> "0-1/2"]
}
it "by a column desc" $
get "/items?id=lte.2&order=desc.id"
get "/items?id=lte.2&order=id.desc"
`shouldRespondWith` ResponseMatcher {
matchBody = Just "[{\"id\":2},{\"id\":1}]"
, matchStatus = 200