Test failed post, and clean up specs

This commit is contained in:
Joe Nelson
2014-08-25 17:27:21 -07:00
parent 93e38dd20d
commit eef7860922
4 changed files with 41 additions and 69 deletions
+6 -1
View File
@@ -33,7 +33,7 @@ instance JSON.FromJSON IncPK where
spec :: Spec
spec = around appWithFixture $
describe "Posting new record" $
context "with no pk supplied" $
context "with no pk supplied" $ do
context "into a table with auto-incrementing pk" $
it "succeeds with 201 and link" $ do
post "/auto_incrementing_pk" [json| { "non_nullable_string":"not null"} |]
@@ -47,3 +47,8 @@ spec = around appWithFixture $
liftIO $ do
incStr record `shouldBe` "not null"
incNullableStr record `shouldBe` Nothing
context "into a table with simple pk" $
it "fails with 400 and error" $
post "/contacts" [json| { "name":"J Doe"} |]
`shouldRespondWith` 400