summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2014-11-10 11:00:47 +0100
committerFélix Sipma <felix.sipma@no-log.org>2014-11-10 11:00:47 +0100
commit316ebb8ad0e0febbba7f8ab14600a699419ed115 (patch)
tree858d646a4a851e75c22574840856df3459250153
parent7555844dd54626d329d93f71f5c2d4d1fd3a26ab (diff)
scaffolding updateangular
-rw-r--r--Handler/Home.hs1
-rw-r--r--mokupona.cabal21
-rw-r--r--test/Handler/HomeSpec.hs26
-rw-r--r--test/Spec.hs (renamed from test/main.hs)8
-rw-r--r--test/TestImport.hs3
5 files changed, 49 insertions, 10 deletions
diff --git a/Handler/Home.hs b/Handler/Home.hs
index 73bba8e..93a8106 100644
--- a/Handler/Home.hs
+++ b/Handler/Home.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE TupleSections, OverloadedStrings #-}
module Handler.Home where
import Import
diff --git a/mokupona.cabal b/mokupona.cabal
index f04a3e0..43ef571 100644
--- a/mokupona.cabal
+++ b/mokupona.cabal
@@ -61,8 +61,9 @@ library
FlexibleContexts
EmptyDataDecls
NoMonomorphismRestriction
- ViewPatterns
DeriveDataTypeable
+ ViewPatterns
+ TupleSections
build-depends: base >= 4 && < 5
, yesod >= 1.4.0 && < 1.5
@@ -139,10 +140,26 @@ executable mokupona-tasks
test-suite test
type: exitcode-stdio-1.0
- main-is: main.hs
+ main-is: Spec.hs
hs-source-dirs: test
ghc-options: -Wall
+ extensions: TemplateHaskell
+ QuasiQuotes
+ OverloadedStrings
+ NoImplicitPrelude
+ CPP
+ MultiParamTypeClasses
+ TypeFamilies
+ GADTs
+ GeneralizedNewtypeDeriving
+ FlexibleContexts
+ EmptyDataDecls
+ NoMonomorphismRestriction
+ DeriveDataTypeable
+ ViewPatterns
+ TupleSections
+
build-depends: base
, mokupona
, yesod-test >= 1.4 && < 1.5
diff --git a/test/Handler/HomeSpec.hs b/test/Handler/HomeSpec.hs
new file mode 100644
index 0000000..fd042d1
--- /dev/null
+++ b/test/Handler/HomeSpec.hs
@@ -0,0 +1,26 @@
+module Handler.HomeSpec
+ ( spec
+ ) where
+
+import TestImport
+
+spec :: Spec
+ 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" "test/Spec.hs" "text/plain" -- talk about self-reference
+ byLabel "What's on the file?" "Some Content"
+
+ statusIs 200
+ -- more debugging printBody
+ htmlCount ".message" 1
+ htmlAllContain ".message" "Some Content"
+ htmlAllContain ".message" "text/plain"
diff --git a/test/main.hs b/test/Spec.hs
index a869b66..d179e28 100644
--- a/test/main.hs
+++ b/test/Spec.hs
@@ -1,7 +1,3 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE NoMonomorphismRestriction #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
-
module Main where
import Import
@@ -10,7 +6,7 @@ import Yesod.Test
import Test.Hspec (hspec)
import Application (makeFoundation)
-import HomeTest
+import qualified Handler.HomeSpec
main :: IO ()
main = do
@@ -20,4 +16,4 @@ main = do
foundation <- makeFoundation conf
hspec $ do
yesodSpec foundation $ do
- homeSpecs
+ Handler.HomeSpec.spec
diff --git a/test/TestImport.hs b/test/TestImport.hs
index 2946b07..aafaf47 100644
--- a/test/TestImport.hs
+++ b/test/TestImport.hs
@@ -1,9 +1,9 @@
-{-# LANGUAGE OverloadedStrings #-}
module TestImport
( module Yesod.Test
, module Model
, module Foundation
, module Database.Persist
+ , module Prelude
, runDB
, Spec
, Example
@@ -13,6 +13,7 @@ import Yesod.Test
import Database.Persist hiding (get)
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
import Control.Monad.IO.Class (liftIO)
+import Prelude
import Foundation
import Model