Separate tests into groups

Also test content of insert redirect
This commit is contained in:
Joe Nelson
2014-08-25 16:53:44 -07:00
parent 731260e9ee
commit f34f8d8c35
3 changed files with 114 additions and 36 deletions
+65
View File
@@ -0,0 +1,65 @@
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
module Feature.StructureSpec where
import Test.Hspec
import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
import SpecHelper
import Network.HTTP.Types
spec :: Spec
spec = around appWithFixture $ do
describe "GET /" $
it "lists views in schema" $
get "/" `shouldRespondWith`
[json| [{"schema":"1","name":"auto_incrementing_pk","insertable":true}] |]
{matchStatus = 200}
describe "Table info" $
it "is available with OPTIONS verb" $
-- {{{ big json object
request methodOptions "/auto_incrementing_pk" "" `shouldRespondWith` [json|
{
"pkey":["id"],
"columns":{
"inserted_at":{
"precision":null,
"updatable":true,
"schema":"1",
"name":"inserted_at",
"type":"timestamp with time zone",
"maxLen":null,
"nullable":true,
"position":4},
"id":{
"precision":32,
"updatable":true,
"schema":"1",
"name":"id",
"type":"integer",
"maxLen":null,
"nullable":false,
"position":1},
"non_nullable_string":{
"precision":null,
"updatable":true,
"schema":"1",
"name":"non_nullable_string",
"type":"character varying",
"maxLen":null,
"nullable":false,
"position":3},
"nullable_string":{
"precision":null,
"updatable":true,
"schema":"1",
"name":"nullable_string",
"type":"character varying",
"maxLen":null,
"nullable":true,
"position":2}}
}
|]
-- }}}