hspec-pg-transact: Helpers for creating database tests with hspec and pg-transact

[ bsd3, library, web ] [ Propose Tags ]

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]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3
Dependencies base (>=4.7 && <5), bytestring, hspec, pg-transact, postgresql-simple, resource-pool, text, tmp-postgres [details]
License BSD-3-Clause
Copyright 2017 Jonathan Fischoff
Author Jonathan Fischoff
Maintainer jonathangfischoff@gmail.com
Category Web
Home page https://github.com/jfischoff/hspec-pg-transact#readme
Source repo head: git clone https://github.com/githubuser/hspec-pg-transact
Uploaded by JonathanFischoff at 2017-06-19T01:54:01Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2536 total (10 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-06-19 [all 1 reports]

Readme for hspec-pg-transact-0.1.0.1

[back to package description]

hspec-pg-transact