This PR inverts control in the test suite. Instead of having each test suite provide a run function which runs the database action, the test suite expects a ConnectionPool to be made available to it. Then the various backends use beforeAll :: IO ConnectionPool -> SpecWith ConnectionPool -> Spec to make it happen.
A further advantage is that we'll be able to use beforeWith :: (ConnectionPool -> IO ConnectionPool) -> SpecWith ConnectionPool -> SpecWith ConnectionPool to implement things like, y'know, inserting test/setup data into the database, and afterWith to clean it up.
This PR inverts control in the test suite. Instead of having each test suite provide a
run
function which runs the database action, the test suite expects aConnectionPool
to be made available to it. Then the various backends usebeforeAll :: IO ConnectionPool -> SpecWith ConnectionPool -> Spec
to make it happen.A further advantage is that we'll be able to use
beforeWith :: (ConnectionPool -> IO ConnectionPool) -> SpecWith ConnectionPool -> SpecWith ConnectionPool
to implement things like, y'know, inserting test/setup data into the database, andafterWith
to clean it up.Before submitting your PR, check that you've:
@since
declarations to the Haddock.stylish-haskell
and otherwise adhered to the style guide.After submitting your PR: