Temporarily use psql to load schemas
This commit is contained in:
@@ -83,3 +83,4 @@ Test-Suite spec
|
||||
, blaze-builder
|
||||
, vector
|
||||
, mtl
|
||||
, process
|
||||
|
||||
+7
-11
@@ -2,28 +2,24 @@
|
||||
module Main where
|
||||
|
||||
import qualified Hasql as H
|
||||
import qualified Hasql.Backend as H
|
||||
import qualified Hasql.Postgres as H
|
||||
import qualified Data.ByteString.Char8 as BS
|
||||
import System.Process
|
||||
import Test.Hspec
|
||||
import SpecHelper
|
||||
import Spec
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
roles <- loadFixture "roles"
|
||||
schema <- loadFixture "schema"
|
||||
H.session pgSettings testSettings $
|
||||
H.tx Nothing $ do
|
||||
H.unit [H.q| drop schema if exists "1" cascade |]
|
||||
H.unit [H.q| drop schema if exists private cascade |]
|
||||
H.unit [H.q| drop schema if exists dbapi cascade |]
|
||||
H.unit roles
|
||||
H.unit schema
|
||||
|
||||
loadFixture "roles"
|
||||
loadFixture "schema"
|
||||
|
||||
hspec spec
|
||||
|
||||
loadFixture :: FilePath -> IO(H.Statement H.Postgres)
|
||||
loadFixture name = do
|
||||
query <- BS.readFile $ "test/fixtures/" ++ name ++ ".sql"
|
||||
return (query, [], False)
|
||||
loadFixture :: FilePath -> IO()
|
||||
loadFixture name =
|
||||
callProcess "psql" ["-U", "postgres", "-d", "dbapi_test", "-a", "-f", "test/fixtures/" ++ name ++ ".sql"]
|
||||
|
||||
Reference in New Issue
Block a user