yammat/test/TestImport.hs
2020-06-05 19:19:02 +02:00

27 lines
862 B
Haskell

module TestImport
( module TestImport
, module X
) where
import Application (makeFoundation)
import ClassyPrelude as X hiding (Handler)
import Database.Persist as X hiding (get, delete, deleteBy)
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
import Foundation as X
import Model as X
import Test.Hspec as X
import Yesod.Default.Config2 (ignoreEnv, loadAppSettings)
import Yesod.Test as X
runDB :: SqlPersistM a -> YesodExample App a
runDB query = do
pool <- fmap appConnPool getTestYesod
liftIO $ runSqlPersistMPool query pool
withApp :: SpecWith (App, a -> a) -> Spec
withApp = before $ do
settings <- loadAppSettings
["config/test-settings.yml", "config/settings.yml"]
[]
ignoreEnv
(, id) <$> makeFoundation settings