Feature specs compile
This commit is contained in:
+21
-9
@@ -1,17 +1,29 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
module Main where
|
||||
|
||||
import Database.PostgreSQL.Simple
|
||||
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 Test.Hspec
|
||||
import SpecHelper
|
||||
import Spec
|
||||
import SpecHelper (openConnection, loadFixture)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
c <-openConnection
|
||||
_ <- execute_ c "drop schema if exists \"1\" cascade"
|
||||
_ <- execute_ c "drop schema if exists private cascade"
|
||||
_ <- execute_ c "drop schema if exists dbapi cascade"
|
||||
loadFixture "roles" c
|
||||
loadFixture "schema" c
|
||||
close c
|
||||
roles <- loadFixture "roles"
|
||||
schema <- loadFixture "schema"
|
||||
H.session pgSettings testSettings $ do
|
||||
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
|
||||
|
||||
hspec spec
|
||||
|
||||
loadFixture :: FilePath -> IO(H.Statement H.Postgres)
|
||||
loadFixture name = do
|
||||
query <- BS.readFile $ "test/fixtures/" ++ name ++ ".sql"
|
||||
return (query, [])
|
||||
|
||||
Reference in New Issue
Block a user