testcontainers-0.2.0.0: Docker containers for your integration tests.

Safe HaskellNone
LanguageHaskell2010

TestContainers.Hspec

Contents

Synopsis

Running containers for tests

withContainers :: forall a. (forall m. MonadDocker m => m a) -> (a -> IO ()) -> IO () Source #

Allow Spec to depend on Docker containers. Hspec takes care of initialization and de-initialization of the containers.

containers :: MonadDocker m => m Boolean
containers = do
  _redis <- TestContainers.run $ TestContainers.containerRequest TestContainers.redis
  _kafka <- TestContainers.run $ TestContainers.containerRequest TestContainers.kafka
  pure True

example :: Spec
example =
  around (withContainers containers) $ describe "Example tests"
    it "first test" $ \isBoolean -> do
      isBoolean shouldBe True

withContainers allows you naturally scope the handling of containers for your tests.

Re-exports for convenience