1. John Lenz
  2. notmuch-web

Commits

John Lenz  committed b6264ad

Get the test suite to compile

  • Participants
  • Parent commits 1652b40
  • Branches default

Comments (0)

Files changed (4)

File notmuch-web.cabal

View file
  • Ignore whitespace
 
     build-depends: base
                  , notmuch-web
+                 , hspec
+                 , yesod
                  , yesod-test
                  , yesod-core

File tests/HomeTest.hs

View file
  • Ignore whitespace
     ( homeSpecs
     ) where
 
-import TestImport
+import Import hiding (get, loadConfig)
+import Yesod.Test
 
-homeSpecs :: Specs
+homeSpecs :: YesodSpec App
 homeSpecs =
-  describe "These are some example tests" $
-    it "loads the index and checks it looks right" $ do
-      get_ "/"
-      statusIs 200
-      htmlAllContain "h1" "Hello"
-
-      post "/" $ do
-        addNonce
-        fileByLabel "Choose a file" "tests/main.hs" "text/plain" -- talk about self-reference
-        byLabel "What's on the file?" "Some Content"
-
-      statusIs 200
-      htmlCount ".message" 1
-      htmlAllContain ".message" "Some Content"
-      htmlAllContain ".message" "text/plain"
+  ydescribe "Basic home page tests" $
+    yit "main page redirects to the login page" $ do
+      get HomeR
+      statusIs 303
+      get ("/auth/login" :: String)
+      bodyContains "Password"

File tests/TestImport.hs

  • Ignore whitespace
-{-# LANGUAGE OverloadedStrings #-}
-module TestImport
-    ( module Yesod.Test
-    , Specs
-    ) where
-
-import Yesod.Test
-
-type Specs = SpecsConn ()

File tests/main.hs

View file
  • Ignore whitespace
 
 module Main where
 
-import Import
+import Settings
+import Test.Hspec
 import Yesod.Default.Config
 import Yesod.Test
-import Settings
 import Application (makeFoundation)
 
 import HomeTest
 main = do
     conf <- loadConfig $ (configSettings Testing) { csParseExtra = parseExtra }
     foundation <- makeFoundation conf
-    app <- toWaiAppPlain foundation
-    runTests app (error "No database available") homeSpecs
+    hspec $ yesodSpec foundation $
+        homeSpecs