yesod-test: Do not use Test.Hspec.Runner

Test.Hspec.Runner will export functions for monadic specs in the future
(Hspec >= 1.4).
This commit is contained in:
Simon Hengel 2012-10-16 14:42:08 +02:00
parent dfae661878
commit ffcf7fbc5d
2 changed files with 17 additions and 5 deletions

View File

@ -65,8 +65,22 @@ module Yesod.Test (
where where
-- In in Hspec < 1.3 the Example instance for IO () (== Assertion/Expectation)
-- is orphan and only export from Test.Hspec.HUnit.
--
-- In Hspec 1.3.* it is still orphan, but re-exported from Test.Hspec.
--
-- Starting with Hspec 1.4.0 it is not orphan anymore.
--
-- As we only support Hspec >= 1.3, we import Test.Hspec to bring the orphan
-- instance into scope. This is better than importing Test.Hspec.HUnit, as
-- Test.Hspec.HUnit may be removed in the future.
--
-- As soon as we decide to drop support for Hspec 1.3.*, we can remove this
-- comment and the following import.
import qualified Test.Hspec ()
import qualified Test.Hspec.Core as Core import qualified Test.Hspec.Core as Core
import qualified Test.Hspec.Runner as Runner
import qualified Data.List as DL import qualified Data.List as DL
import qualified Data.Maybe as DY import qualified Data.Maybe as DY
import qualified Data.ByteString.Char8 as BS8 import qualified Data.ByteString.Char8 as BS8
@ -75,7 +89,6 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as TE import qualified Data.Text.Encoding as TE
import qualified Data.ByteString.Lazy.Char8 as BSL8 import qualified Data.ByteString.Lazy.Char8 as BSL8
import qualified Test.HUnit as HUnit import qualified Test.HUnit as HUnit
import qualified Test.Hspec.HUnit ()
import qualified Network.HTTP.Types as H import qualified Network.HTTP.Types as H
import qualified Network.Socket.Internal as Sock import qualified Network.Socket.Internal as Sock
import Data.CaseInsensitive (CI) import Data.CaseInsensitive (CI)
@ -143,7 +156,7 @@ type CookieValue = ByteString
runTests :: Application -> Pool conn -> SpecsConn conn -> IO () runTests :: Application -> Pool conn -> SpecsConn conn -> IO ()
runTests app connection specsDef = do runTests app connection specsDef = do
(SpecsData _ _ specs) <- ST.execStateT specsDef (SpecsData app connection []) (SpecsData _ _ specs) <- ST.execStateT specsDef (SpecsData app connection [])
Runner.hspec specs Core.hspec specs
-- | Start describing a Tests suite keeping cookies and a reference to the tested 'Application' -- | Start describing a Tests suite keeping cookies and a reference to the tested 'Application'
-- and 'ConnectionPool' -- and 'ConnectionPool'

View File

@ -1,8 +1,7 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
import Test.HUnit hiding (Test) import Test.HUnit hiding (Test)
import Test.Hspec.Monadic import Test.Hspec
import Test.Hspec.HUnit ()
import Yesod.Test.CssQuery import Yesod.Test.CssQuery
import Yesod.Test.TransversingCSS import Yesod.Test.TransversingCSS