2015-04-04 04:46:33 +00:00
|
|
|
module TestImport
|
|
|
|
( module TestImport
|
|
|
|
, module X
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Application (makeFoundation)
|
2020-06-05 16:37:19 +00:00
|
|
|
import ClassyPrelude as X hiding (Handler)
|
2020-06-05 16:56:13 +00:00
|
|
|
import Database.Persist as X hiding (get, delete, deleteBy)
|
2015-04-04 04:46:33 +00:00
|
|
|
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
|
|
|
|
|
2020-06-05 17:18:43 +00:00
|
|
|
withApp :: SpecWith (App, a -> a) -> Spec
|
2015-04-04 04:46:33 +00:00
|
|
|
withApp = before $ do
|
|
|
|
settings <- loadAppSettings
|
|
|
|
["config/test-settings.yml", "config/settings.yml"]
|
|
|
|
[]
|
|
|
|
ignoreEnv
|
2020-06-05 17:18:43 +00:00
|
|
|
(, id) <$> makeFoundation settings
|