hspec/hspec — pull request #150 by DanielG (2013-12-23 16:17:56+00:00)
Title: Add ability to hook main with hspec-discover

This patch adds the --hookMain flag to hspec-discover, when this flag is set
hspec-discover generates a module called "Spec" instead of the usual "Main" and
it renames the "main" function to "hspecMain".

The purpose of this is to have the ability to add custom IO actions before/after
any tests are run instead of before and after each test item as is already
possible with the functions before, after and around.

To use --hookMain one would create a new Main module and import the Spec module
from there and then call hspecMain when appropriate.

To pass the --hookMain flag to hspec-discover when using it as a ghc
pre-processor the following should be put in Spec.hs:

{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --hookMain #-}