only create schema once

This commit is contained in:
Adam C. Baker
2014-12-29 17:57:31 -08:00
parent 23a75aefcc
commit c9b960f955
10 changed files with 20 additions and 14 deletions
+1 -2
View File
@@ -11,8 +11,7 @@ import SpecHelper
-- }}}
spec :: Spec
spec = beforeAll resetDb $ around withApp $
describe "authorization" $ do
spec = around withApp $ describe "authorization" $ do
it "hides tables that anonymous does not own" $
get "/authors_only" `shouldRespondWith` 404
it "indicates login failure" $ do
+1 -2
View File
@@ -12,8 +12,7 @@ import Network.HTTP.Types
-- }}}
spec :: Spec
spec = beforeAll resetDb $ around withApp $
describe "CORS" $ do
spec = around withApp $ describe "CORS" $ do
let preflightHeaders = [
("Accept", "*/*"),
("Origin", "http://example.com"),
+1 -1
View File
@@ -19,7 +19,7 @@ import TestTypes(IncPK(..), CompoundPK(..))
--import Debug.Trace
spec :: Spec
spec = beforeAll resetDb $ around withApp $ do
spec = around withApp $ do
describe "Posting new record" $ do
after_ (clearTable "menagerie") . it "accepts disparate json types" $ do
p <- post "/menagerie"
+2 -4
View File
@@ -6,10 +6,8 @@ import Test.Hspec.Wai
import SpecHelper
spec :: Spec
spec = beforeAll (do
resetDb
createItems 15
) . afterAll_ (clearTable "items") . around withApp $ do
spec = beforeAll (clearTable "items" >> createItems 15)
. afterAll_ (clearTable "items") . around withApp $ do
describe "Querying a nonexistent table" $
it "causes a 404" $
get "/faketable" `shouldRespondWith` 404
+1 -1
View File
@@ -8,7 +8,7 @@ import Network.Wai.Test (SResponse(simpleHeaders,simpleStatus))
import SpecHelper
spec :: Spec
spec = beforeAll (resetDb >> createItems 15) . afterAll_ (clearTable "items")
spec = beforeAll (clearTable "items" >> createItems 15) . afterAll_ (clearTable "items")
. around withApp $
describe "GET /items" $ do
+1 -1
View File
@@ -10,7 +10,7 @@ import SpecHelper
import Network.HTTP.Types
spec :: Spec
spec = beforeAll resetDb $ around withApp $ do
spec = around withApp $ do
describe "GET /" $ do
it "lists views in schema" $
request methodGet "/" [] ""