The hspec-pg-transact package

[Tags:bsd3, library]

Helpers for creating database tests with hspec and pg-transact

hspec-pg-transact utilizes tmp-postgres to automatically and connect to a temporary instance of postgres on a random port.

describeDB migrate "Query” $
  itDB "work" $ do
    execute_ [sql|
      INSERT INTO things
      VALUES (‘me’) |]
    query_ [sql|
      SELECT name
       FROM things |]
      `shouldReturn` [Only "me"]

In the example above describeDB wraps describe with a beforeAll hook for creating a db and a afterAll hook for stopping a db.

Tests can be written with itDB which is wrapper around it that uses the passed in Connection to run a db transaction automatically for the test.

The libary also provides a few other functions for more fine grained control over running transactions in tests.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2
Dependencies base (>=4.7 && <5), bytestring, hspec, pg-transact, postgresql-simple, resource-pool, text, tmp-postgres [details]
License BSD3
Copyright 2017 Jonathan Fischoff
Author Jonathan Fischoff
Maintainer jonathangfischoff@gmail.com
Category Web
Home page https://github.com/jfischoff/hspec-pg-transact#readme
Source repository head: git clone https://github.com/githubuser/hspec-pg-transact
Uploaded Mon Jun 19 01:54:01 UTC 2017 by JonathanFischoff
Distributions LTSHaskell:0.1.0.2, NixOS:0.1.0.2, Stackage:0.1.0.2
Downloads 127 total (27 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-06-19 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for hspec-pg-transact

Readme for hspec-pg-transact-0.1.0.1

hspec-pg-transact