aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillermo Ramos2014-09-27 15:34:15 +0200
committerGuillermo Ramos2014-09-27 16:12:49 +0200
commit6e99d20972bec95d3502ef7549d74f67b4cf0001 (patch)
tree387c36753f158db69dc117ede96a8586d4697f63 /tests
downloadturing-web-6e99d20972bec95d3502ef7549d74f67b4cf0001.tar.gz
Initial commit (using Yesod's scaffolding)
Diffstat (limited to 'tests')
-rw-r--r--tests/HomeTest.hs28
-rw-r--r--tests/TestImport.hs13
-rw-r--r--tests/main.hs23
3 files changed, 64 insertions, 0 deletions
diff --git a/tests/HomeTest.hs b/tests/HomeTest.hs
new file mode 100644
index 0000000..25a23b1
--- /dev/null
+++ b/tests/HomeTest.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE OverloadedStrings #-}
+module HomeTest
+ ( homeSpecs
+ ) where
+
+import TestImport
+
+homeSpecs :: Spec
+homeSpecs =
+ ydescribe "These are some example tests" $ do
+
+ yit "loads the index and checks it looks right" $ do
+ get HomeR
+ statusIs 200
+ htmlAllContain "h1" "Hello"
+
+ request $ do
+ setMethod "POST"
+ setUrl HomeR
+ addNonce
+ fileByLabel "Choose a file" "tests/main.hs" "text/plain" -- talk about self-reference
+ byLabel "What's on the file?" "Some Content"
+
+ statusIs 200
+ printBody
+ htmlCount ".message" 1
+ htmlAllContain ".message" "Some Content"
+ htmlAllContain ".message" "text/plain"
diff --git a/tests/TestImport.hs b/tests/TestImport.hs
new file mode 100644
index 0000000..04249f9
--- /dev/null
+++ b/tests/TestImport.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE OverloadedStrings #-}
+module TestImport
+ ( module Yesod.Test
+ , module Foundation
+ , Spec
+ , Example
+ ) where
+
+import Yesod.Test
+import Foundation
+
+type Spec = YesodSpec App
+type Example = YesodExample App
diff --git a/tests/main.hs b/tests/main.hs
new file mode 100644
index 0000000..a869b66
--- /dev/null
+++ b/tests/main.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoMonomorphismRestriction #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module Main where
+
+import Import
+import Yesod.Default.Config
+import Yesod.Test
+import Test.Hspec (hspec)
+import Application (makeFoundation)
+
+import HomeTest
+
+main :: IO ()
+main = do
+ conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
+ { csParseExtra = parseExtra
+ }
+ foundation <- makeFoundation conf
+ hspec $ do
+ yesodSpec foundation $ do
+ homeSpecs