aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorA.D <Raveline@users.noreply.github.com>2019-05-03 10:40:07 +0200
committerGitHub <noreply@github.com>2019-05-03 10:40:07 +0200
commitfc6d19e370eded2d5c819d1ef186e26ecd9419f2 (patch)
tree6694853fc7705a67b4f8b9f8ac92c4a53d026a94
parent8c738ffcd5ba7ad6c38303857cd351d01d4bba5f (diff)
parentd8e546eb86a18c4e61c2e2f0844d5c29dd358d38 (diff)
downloadsqueal-hspec-fc6d19e370eded2d5c819d1ef186e26ecd9419f2.tar.gz
squeal-hspec-fc6d19e370eded2d5c819d1ef186e26ecd9419f2.tar.zst
squeal-hspec-fc6d19e370eded2d5c819d1ef186e26ecd9419f2.zip
Merge pull request #1 from Raveline/bump-squeal
Follow latest Squeal commit
-rw-r--r--src/Squeal/PostgreSQL/Hspec.hs23
-rw-r--r--stack.yaml12
2 files changed, 16 insertions, 19 deletions
diff --git a/src/Squeal/PostgreSQL/Hspec.hs b/src/Squeal/PostgreSQL/Hspec.hs
index 44011b7..3cd886b 100644
--- a/src/Squeal/PostgreSQL/Hspec.hs
+++ b/src/Squeal/PostgreSQL/Hspec.hs
@@ -10,7 +10,6 @@ The libary also provides a few other functions for more fine grained control ove
10-} 10-}
11{-# LANGUAGE DataKinds #-} 11{-# LANGUAGE DataKinds #-}
12{-# LANGUAGE FlexibleContexts #-} 12{-# LANGUAGE FlexibleContexts #-}
13{-# LANGUAGE KindSignatures #-}
14{-# LANGUAGE MonoLocalBinds #-} 13{-# LANGUAGE MonoLocalBinds #-}
15{-# LANGUAGE RankNTypes #-} 14{-# LANGUAGE RankNTypes #-}
16{-# LANGUAGE RecordWildCards #-} 15{-# LANGUAGE RecordWildCards #-}
@@ -21,13 +20,11 @@ where
21 20
22import Control.Exception 21import Control.Exception
23import Control.Monad 22import Control.Monad
24import Control.Monad.Base (liftBase) 23import Control.Monad.Base (liftBase)
25import Control.Monad.Trans.Control (MonadBaseControl) 24import qualified Data.ByteString.Char8 as BSC
26import qualified Data.ByteString.Char8 as BSC 25import qualified Database.Postgres.Temp as Temp
27import qualified Database.Postgres.Temp as Temp 26import Generics.SOP (K)
28import Generics.SOP (K)
29import Squeal.PostgreSQL 27import Squeal.PostgreSQL
30import Squeal.PostgreSQL.Migration
31import Squeal.PostgreSQL.Pool 28import Squeal.PostgreSQL.Pool
32import Test.Hspec 29import Test.Hspec
33 30
@@ -38,17 +35,13 @@ data TestDB a = TestDB
38 -- ^ Pool of 50 connections to the temporary @postgres@ 35 -- ^ Pool of 50 connections to the temporary @postgres@
39 } 36 }
40 37
41type Migrations schema m a = (MonadBaseControl IO m) =>
42 PQ (("schema_migrations" ::: Table MigrationsTable) ': '[])
43 (("schema_migrations" ::: Table MigrationsTable) ': schema) m a
44
45type Fixtures schema = (Pool (K Connection schema) -> IO ()) 38type Fixtures schema = (Pool (K Connection schema) -> IO ())
46type Actions schema a = PoolPQ schema IO a 39type Actions schema a = PoolPQ schema IO a
47type SquealContext (schema :: SchemaType) = TestDB (K Connection schema) 40type SquealContext schema = TestDB (K Connection schema)
48 41
49-- | Start a temporary @postgres@ process and create a pool of connections to it 42-- | Start a temporary @postgres@ process and create a pool of connections to it
50setupDB 43setupDB
51 :: Migrations schema IO a 44 :: AlignedList (Migration (Terminally PQ IO)) schema0 schema
52 -> Fixtures schema 45 -> Fixtures schema
53 -> IO (SquealContext schema) 46 -> IO (SquealContext schema)
54setupDB migration fixtures = do 47setupDB migration fixtures = do
@@ -63,7 +56,7 @@ setupDB migration fixtures = do
63 singleStripe 56 singleStripe
64 keepConnectionForOneHour 57 keepConnectionForOneHour
65 poolSizeOfFifty 58 poolSizeOfFifty
66 withConnection connectionString migration 59 withConnection connectionString (migrateUp migration)
67 fixtures pool 60 fixtures pool
68 pure TestDB {..} 61 pure TestDB {..}
69 62
@@ -105,7 +98,7 @@ itDB msg action = it msg $ void . withDB action
105-- 98--
106-- hook for stopping a db. 99-- hook for stopping a db.
107describeDB 100describeDB
108 :: Migrations schema IO a 101 :: AlignedList (Migration (Terminally PQ IO)) schema0 schema
109 -> Fixtures schema 102 -> Fixtures schema
110 -> String 103 -> String
111 -> SpecWith (SquealContext schema) 104 -> SpecWith (SquealContext schema)
diff --git a/stack.yaml b/stack.yaml
index 913ef7a..2b8364b 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -18,7 +18,7 @@
18# 18#
19# resolver: ./custom-snapshot.yaml 19# resolver: ./custom-snapshot.yaml
20# resolver: https://example.com/snapshots/2018-01-01.yaml 20# resolver: https://example.com/snapshots/2018-01-01.yaml
21resolver: lts-12.20 21resolver: lts-13.18
22 22
23# User packages to be built. 23# User packages to be built.
24# Various formats can be used as shown in the example below. 24# Various formats can be used as shown in the example below.
@@ -40,9 +40,13 @@ packages:
40# using the same syntax as the packages field. 40# using the same syntax as the packages field.
41# (e.g., acme-missiles-0.3) 41# (e.g., acme-missiles-0.3)
42extra-deps: 42extra-deps:
43 - squeal-postgresql-0.4.0.0 43 - git: https://github.com/morphismtech/squeal
44 - records-sop-0.1.0.2 44 commit: cd3de98230645ba763183fcae3f7c38faf119c89
45 - tmp-postgres-0.1.1.0 45 subdirs:
46 - squeal-postgresql
47 - unliftio-pool-0.2.1.0@sha256:4de658feb1b10051c5af024c20cd7baa369c777716c54a7b3e2888a73286aecf
48 - records-sop-0.1.0.2
49 - tmp-postgres-0.1.1.0
46 50
47# Override default flag values for local packages and extra-deps 51# Override default flag values for local packages and extra-deps
48# flags: {} 52# flags: {}