Ensure db fixtures loaded in feature specs

This commit is contained in:
Joe Nelson
2014-08-17 16:18:09 -07:00
parent 3a646a4eb4
commit 0fbfa2395b
4 changed files with 29 additions and 14 deletions
+1 -8
View File
@@ -5,18 +5,11 @@ module Unit.PgQuerySpec where
import Test.Hspec
import Database.HDBC
import Database.HDBC.PostgreSQL
import PgQuery (insert)
import Types (SqlRow(..))
loadFixture :: String -> IO Connection
loadFixture name = do
conn <- connectPostgreSQL "postgres://postgres:@localhost:5432/dbapi_test"
sql <- readFile $ "test/fixtures/" ++ name ++ ".sql"
runRaw conn "drop schema if exists \"1\" cascade"
runRaw conn sql
return conn
import SpecHelper
main :: IO ()
main = hspec spec