gonito/test/Handler/HomeSpec.hs

24 lines
794 B
Haskell
Raw Normal View History

2018-09-20 13:02:07 +02:00
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
2015-08-20 22:33:38 +02:00
module Handler.HomeSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
2018-09-20 13:02:07 +02:00
describe "Homepage" $ do
it "loads the index and checks it looks right" $ do
get HomeR
statusIs 200
htmlAnyContain "h1" "Welcome to Gonito.net!"
2015-08-20 22:33:38 +02:00
2018-09-20 13:02:07 +02:00
-- This is a simple example of using a database access in a test. The
-- test will succeed for a fresh scaffolded site with an empty database,
-- but will fail on an existing database with a non-empty user table.
it "leaves the user table empty" $ do
get HomeR
statusIs 200
users <- runDB $ selectList ([] :: [Filter User]) []
assertEq "user table empty" 0 $ length users