From c9e92ffc6795e2ad24a364e888dde05f6d7f94ef Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Sun, 10 Aug 2014 19:15:43 -0700 Subject: [PATCH] WIP: load fixture before all tests --- test/PgQuerySpec.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/PgQuerySpec.hs b/test/PgQuerySpec.hs index 4927d9b72..de506a39a 100644 --- a/test/PgQuerySpec.hs +++ b/test/PgQuerySpec.hs @@ -7,21 +7,22 @@ import Database.HDBC.PostgreSQL loadFixture :: String -> IO () loadFixture name = do - sql <- readFile $ "test/fixtures/" ++ name ++ ".sql" conn <- connectPostgreSQL "postgres://postgres:@localhost:5432/dbapi_test" + sql <- readFile $ "test/fixtures/" ++ name ++ ".sql" + runRaw conn "drop schema if exists public cascade" + runRaw conn "create schema public" runRaw conn sql commit conn main :: IO () -main = do - hspec spec +main = hspec spec spec :: Spec spec = beforeAll (loadFixture "schema") $ do describe "insert" $ - it "can insert into an empty table" $ + it "can insert into an empty table" $ \_ -> head [23 ..] `shouldBe` (23 :: Int) describe "insert again" $ - it "is true" $ + it "is true" $ \_ -> True `shouldBe` True