1 module Handler.HomeSpec (spec) where
7 it "loads the index and checks it looks right" $ do
10 htmlAllContain "h1" "Welcome to Yesod"
16 fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
17 byLabel "What's on the file?" "Some Content"
20 -- more debugging printBody
21 htmlCount ".message" 1
22 htmlAllContain ".message" "Some Content"
23 htmlAllContain ".message" "text/plain"
25 -- This is a simple example of using a database access in a test. The
26 -- test will succeed for a fresh scaffolded site with an empty database,
27 -- but will fail on an existing database with a non-empty user table.
28 it "leaves the user table empty" $ do
31 users <- runDB $ selectList ([] :: [Filter User]) []
32 assertEqual "user table empty" 0 $ length users