Scaffolding update
This commit is contained in:
parent
1d88c61306
commit
30780add67
@ -279,7 +279,6 @@ getExtra = fmap (appExtra . settings) getYesod
|
|||||||
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -415,6 +414,7 @@ library
|
|||||||
NoMonomorphismRestriction
|
NoMonomorphismRestriction
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -461,10 +461,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -9002,7 +9018,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -9019,17 +9035,16 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -9041,11 +9056,11 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
@ -9059,13 +9074,34 @@ homeSpecs =
|
|||||||
users <- runDB $ selectList ([] :: [Filter User]) []
|
users <- runDB $ selectList ([] :: [Filter User]) []
|
||||||
assertEqual "user table empty" 0 $ L.length users
|
assertEqual "user table empty" 0 $ L.length users
|
||||||
|
|
||||||
|
{-# START_FILE test/Spec.hs #-}
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Yesod.Default.Config
|
||||||
|
import Yesod.Test
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
import Application (makeFoundation)
|
||||||
|
|
||||||
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
|
||||||
|
{ csParseExtra = parseExtra
|
||||||
|
}
|
||||||
|
foundation <- makeFoundation conf
|
||||||
|
hspec $ do
|
||||||
|
yesodSpec foundation $ do
|
||||||
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
module TestImport
|
module TestImport
|
||||||
( module Yesod.Test
|
( module Yesod.Test
|
||||||
, module Model
|
, module Model
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Database.Persist
|
, module Database.Persist
|
||||||
|
, module Prelude
|
||||||
, runDB
|
, runDB
|
||||||
, Spec
|
, Spec
|
||||||
, Example
|
, Example
|
||||||
@ -9077,6 +9113,7 @@ import Database.Persist.MongoDB hiding (master)
|
|||||||
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
|
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
|
||||||
import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
|
import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Model
|
import Model
|
||||||
@ -9089,28 +9126,3 @@ runDB query = do
|
|||||||
pool <- fmap connPool getTestYesod
|
pool <- fmap connPool getTestYesod
|
||||||
liftIO $ runResourceT $ runNoLoggingT $ runMongoDBPoolDef query pool
|
liftIO $ runResourceT $ runNoLoggingT $ runMongoDBPoolDef query pool
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# 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
|
|
||||||
|
|
||||||
|
|||||||
@ -292,7 +292,6 @@ getExtra = fmap (appExtra . settings) getYesod
|
|||||||
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -425,6 +424,7 @@ library
|
|||||||
NoMonomorphismRestriction
|
NoMonomorphismRestriction
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -471,10 +471,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -9021,7 +9037,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -9038,17 +9054,16 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -9060,11 +9075,11 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
@ -9078,13 +9093,34 @@ homeSpecs =
|
|||||||
users <- runDB $ selectList ([] :: [Filter User]) []
|
users <- runDB $ selectList ([] :: [Filter User]) []
|
||||||
assertEqual "user table empty" 0 $ L.length users
|
assertEqual "user table empty" 0 $ L.length users
|
||||||
|
|
||||||
|
{-# START_FILE test/Spec.hs #-}
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Yesod.Default.Config
|
||||||
|
import Yesod.Test
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
import Application (makeFoundation)
|
||||||
|
|
||||||
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
|
||||||
|
{ csParseExtra = parseExtra
|
||||||
|
}
|
||||||
|
foundation <- makeFoundation conf
|
||||||
|
hspec $ do
|
||||||
|
yesodSpec foundation $ do
|
||||||
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
module TestImport
|
module TestImport
|
||||||
( module Yesod.Test
|
( module Yesod.Test
|
||||||
, module Model
|
, module Model
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Database.Persist
|
, module Database.Persist
|
||||||
|
, module Prelude
|
||||||
, runDB
|
, runDB
|
||||||
, Spec
|
, Spec
|
||||||
, Example
|
, Example
|
||||||
@ -9094,6 +9130,7 @@ import Yesod.Test
|
|||||||
import Database.Persist hiding (get)
|
import Database.Persist hiding (get)
|
||||||
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Model
|
import Model
|
||||||
@ -9106,28 +9143,3 @@ runDB query = do
|
|||||||
pool <- fmap connPool getTestYesod
|
pool <- fmap connPool getTestYesod
|
||||||
liftIO $ runSqlPersistMPool query pool
|
liftIO $ runSqlPersistMPool query pool
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# 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
|
|
||||||
|
|
||||||
|
|||||||
@ -322,7 +322,6 @@ onCommand render command =
|
|||||||
Nothing -> invalidArgs ["Invalid command"]
|
Nothing -> invalidArgs ["Invalid command"]
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -462,6 +461,7 @@ library
|
|||||||
RankNTypes
|
RankNTypes
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -509,10 +509,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -9129,7 +9145,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -9151,17 +9167,16 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -9173,11 +9188,11 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
@ -9191,13 +9206,34 @@ homeSpecs =
|
|||||||
users <- runDB $ selectList ([] :: [Filter User]) []
|
users <- runDB $ selectList ([] :: [Filter User]) []
|
||||||
assertEqual "user table empty" 0 $ L.length users
|
assertEqual "user table empty" 0 $ L.length users
|
||||||
|
|
||||||
|
{-# START_FILE test/Spec.hs #-}
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Yesod.Default.Config
|
||||||
|
import Yesod.Test
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
import Application (makeFoundation)
|
||||||
|
|
||||||
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
|
||||||
|
{ csParseExtra = parseExtra
|
||||||
|
}
|
||||||
|
foundation <- makeFoundation conf
|
||||||
|
hspec $ do
|
||||||
|
yesodSpec foundation $ do
|
||||||
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
module TestImport
|
module TestImport
|
||||||
( module Yesod.Test
|
( module Yesod.Test
|
||||||
, module Model
|
, module Model
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Database.Persist
|
, module Database.Persist
|
||||||
|
, module Prelude
|
||||||
, runDB
|
, runDB
|
||||||
, Spec
|
, Spec
|
||||||
, Example
|
, Example
|
||||||
@ -9207,6 +9243,7 @@ import Yesod.Test
|
|||||||
import Database.Persist hiding (get)
|
import Database.Persist hiding (get)
|
||||||
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Model
|
import Model
|
||||||
@ -9219,28 +9256,3 @@ runDB query = do
|
|||||||
pool <- fmap connPool getTestYesod
|
pool <- fmap connPool getTestYesod
|
||||||
liftIO $ runSqlPersistMPool query pool
|
liftIO $ runSqlPersistMPool query pool
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# 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
|
|
||||||
|
|
||||||
|
|||||||
@ -292,7 +292,6 @@ getExtra = fmap (appExtra . settings) getYesod
|
|||||||
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -425,6 +424,7 @@ library
|
|||||||
NoMonomorphismRestriction
|
NoMonomorphismRestriction
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -471,10 +471,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -9021,7 +9037,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -9038,17 +9054,16 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -9060,11 +9075,11 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
@ -9078,13 +9093,34 @@ homeSpecs =
|
|||||||
users <- runDB $ selectList ([] :: [Filter User]) []
|
users <- runDB $ selectList ([] :: [Filter User]) []
|
||||||
assertEqual "user table empty" 0 $ L.length users
|
assertEqual "user table empty" 0 $ L.length users
|
||||||
|
|
||||||
|
{-# START_FILE test/Spec.hs #-}
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Yesod.Default.Config
|
||||||
|
import Yesod.Test
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
import Application (makeFoundation)
|
||||||
|
|
||||||
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
|
||||||
|
{ csParseExtra = parseExtra
|
||||||
|
}
|
||||||
|
foundation <- makeFoundation conf
|
||||||
|
hspec $ do
|
||||||
|
yesodSpec foundation $ do
|
||||||
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
module TestImport
|
module TestImport
|
||||||
( module Yesod.Test
|
( module Yesod.Test
|
||||||
, module Model
|
, module Model
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Database.Persist
|
, module Database.Persist
|
||||||
|
, module Prelude
|
||||||
, runDB
|
, runDB
|
||||||
, Spec
|
, Spec
|
||||||
, Example
|
, Example
|
||||||
@ -9094,6 +9130,7 @@ import Yesod.Test
|
|||||||
import Database.Persist hiding (get)
|
import Database.Persist hiding (get)
|
||||||
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Model
|
import Model
|
||||||
@ -9106,28 +9143,3 @@ runDB query = do
|
|||||||
pool <- fmap connPool getTestYesod
|
pool <- fmap connPool getTestYesod
|
||||||
liftIO $ runSqlPersistMPool query pool
|
liftIO $ runSqlPersistMPool query pool
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# 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
|
|
||||||
|
|
||||||
|
|||||||
@ -229,7 +229,6 @@ getExtra = fmap (appExtra . settings) getYesod
|
|||||||
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -344,6 +343,7 @@ library
|
|||||||
NoMonomorphismRestriction
|
NoMonomorphismRestriction
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -387,10 +387,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -8878,7 +8894,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -8895,16 +8911,15 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -8916,35 +8931,16 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/Spec.hs #-}
|
||||||
{-# 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
|
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE NoMonomorphismRestriction #-}
|
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -8953,7 +8949,7 @@ import Yesod.Test
|
|||||||
import Test.Hspec (hspec)
|
import Test.Hspec (hspec)
|
||||||
import Application (makeFoundation)
|
import Application (makeFoundation)
|
||||||
|
|
||||||
import HomeTest
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
@ -8963,5 +8959,21 @@ main = do
|
|||||||
foundation <- makeFoundation conf
|
foundation <- makeFoundation conf
|
||||||
hspec $ do
|
hspec $ do
|
||||||
yesodSpec foundation $ do
|
yesodSpec foundation $ do
|
||||||
homeSpecs
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
|
module TestImport
|
||||||
|
( module Yesod.Test
|
||||||
|
, module Foundation
|
||||||
|
, module Prelude
|
||||||
|
, Spec
|
||||||
|
, Example
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Yesod.Test
|
||||||
|
import Prelude
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
type Spec = YesodSpec App
|
||||||
|
type Example = YesodExample App
|
||||||
|
|
||||||
|
|||||||
@ -292,7 +292,6 @@ getExtra = fmap (appExtra . settings) getYesod
|
|||||||
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
-- https://github.com/yesodweb/yesod/wiki/Sending-email
|
||||||
|
|
||||||
{-# START_FILE Handler/Home.hs #-}
|
{-# START_FILE Handler/Home.hs #-}
|
||||||
{-# LANGUAGE TupleSections, OverloadedStrings #-}
|
|
||||||
module Handler.Home where
|
module Handler.Home where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -425,6 +424,7 @@ library
|
|||||||
NoMonomorphismRestriction
|
NoMonomorphismRestriction
|
||||||
DeriveDataTypeable
|
DeriveDataTypeable
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod >= 1.4.0 && < 1.5
|
, yesod >= 1.4.0 && < 1.5
|
||||||
@ -471,10 +471,26 @@ executable PROJECTNAME
|
|||||||
|
|
||||||
test-suite test
|
test-suite test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: main.hs
|
main-is: Spec.hs
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
extensions: TemplateHaskell
|
||||||
|
QuasiQuotes
|
||||||
|
OverloadedStrings
|
||||||
|
NoImplicitPrelude
|
||||||
|
CPP
|
||||||
|
MultiParamTypeClasses
|
||||||
|
TypeFamilies
|
||||||
|
GADTs
|
||||||
|
GeneralizedNewtypeDeriving
|
||||||
|
FlexibleContexts
|
||||||
|
EmptyDataDecls
|
||||||
|
NoMonomorphismRestriction
|
||||||
|
DeriveDataTypeable
|
||||||
|
ViewPatterns
|
||||||
|
TupleSections
|
||||||
|
|
||||||
build-depends: base
|
build-depends: base
|
||||||
, PROJECTNAME
|
, PROJECTNAME
|
||||||
, yesod-test >= 1.4 && < 1.5
|
, yesod-test >= 1.4 && < 1.5
|
||||||
@ -9008,7 +9024,7 @@ $maybe msg <- mmsg
|
|||||||
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
<form method=post action=@{HomeR}#form enctype=#{formEnctype}>
|
||||||
^{formWidget}
|
^{formWidget}
|
||||||
<button .btn .btn-primary type="submit">
|
<button .btn .btn-primary type="submit">
|
||||||
Send it! <span class="glyphicon glyphicon-upload">
|
Send it! <span class="glyphicon glyphicon-upload"></span>
|
||||||
|
|
||||||
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
<li> And last but not least, Testing. In <em>tests/main.hs</em> you will find a #
|
||||||
test suite that performs tests on this page. #
|
test suite that performs tests on this page. #
|
||||||
@ -9025,17 +9041,16 @@ h2##{aDomId} {
|
|||||||
color: #990
|
color: #990
|
||||||
}
|
}
|
||||||
|
|
||||||
{-# START_FILE test/HomeTest.hs #-}
|
{-# START_FILE test/Handler/HomeSpec.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
module Handler.HomeSpec
|
||||||
module HomeTest
|
( spec
|
||||||
( homeSpecs
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import TestImport
|
import TestImport
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
|
|
||||||
homeSpecs :: Spec
|
spec :: Spec
|
||||||
homeSpecs =
|
spec =
|
||||||
ydescribe "These are some example tests" $ do
|
ydescribe "These are some example tests" $ do
|
||||||
|
|
||||||
yit "loads the index and checks it looks right" $ do
|
yit "loads the index and checks it looks right" $ do
|
||||||
@ -9047,11 +9062,11 @@ homeSpecs =
|
|||||||
setMethod "POST"
|
setMethod "POST"
|
||||||
setUrl HomeR
|
setUrl HomeR
|
||||||
addNonce
|
addNonce
|
||||||
fileByLabel "Choose a file" "test/main.hs" "text/plain" -- talk about self-reference
|
fileByLabel "Choose a file" "test/Spec.hs" "text/plain" -- talk about self-reference
|
||||||
byLabel "What's on the file?" "Some Content"
|
byLabel "What's on the file?" "Some Content"
|
||||||
|
|
||||||
statusIs 200
|
statusIs 200
|
||||||
printBody
|
-- more debugging printBody
|
||||||
htmlCount ".message" 1
|
htmlCount ".message" 1
|
||||||
htmlAllContain ".message" "Some Content"
|
htmlAllContain ".message" "Some Content"
|
||||||
htmlAllContain ".message" "text/plain"
|
htmlAllContain ".message" "text/plain"
|
||||||
@ -9065,13 +9080,34 @@ homeSpecs =
|
|||||||
users <- runDB $ selectList ([] :: [Filter User]) []
|
users <- runDB $ selectList ([] :: [Filter User]) []
|
||||||
assertEqual "user table empty" 0 $ L.length users
|
assertEqual "user table empty" 0 $ L.length users
|
||||||
|
|
||||||
|
{-# START_FILE test/Spec.hs #-}
|
||||||
|
module Main where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Yesod.Default.Config
|
||||||
|
import Yesod.Test
|
||||||
|
import Test.Hspec (hspec)
|
||||||
|
import Application (makeFoundation)
|
||||||
|
|
||||||
|
import qualified Handler.HomeSpec
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
conf <- Yesod.Default.Config.loadConfig $ (configSettings Testing)
|
||||||
|
{ csParseExtra = parseExtra
|
||||||
|
}
|
||||||
|
foundation <- makeFoundation conf
|
||||||
|
hspec $ do
|
||||||
|
yesodSpec foundation $ do
|
||||||
|
Handler.HomeSpec.spec
|
||||||
|
|
||||||
{-# START_FILE test/TestImport.hs #-}
|
{-# START_FILE test/TestImport.hs #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
module TestImport
|
module TestImport
|
||||||
( module Yesod.Test
|
( module Yesod.Test
|
||||||
, module Model
|
, module Model
|
||||||
, module Foundation
|
, module Foundation
|
||||||
, module Database.Persist
|
, module Database.Persist
|
||||||
|
, module Prelude
|
||||||
, runDB
|
, runDB
|
||||||
, Spec
|
, Spec
|
||||||
, Example
|
, Example
|
||||||
@ -9081,6 +9117,7 @@ import Yesod.Test
|
|||||||
import Database.Persist hiding (get)
|
import Database.Persist hiding (get)
|
||||||
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
import Database.Persist.Sql (SqlPersistM, runSqlPersistMPool)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Prelude
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Model
|
import Model
|
||||||
@ -9093,28 +9130,3 @@ runDB query = do
|
|||||||
pool <- fmap connPool getTestYesod
|
pool <- fmap connPool getTestYesod
|
||||||
liftIO $ runSqlPersistMPool query pool
|
liftIO $ runSqlPersistMPool query pool
|
||||||
|
|
||||||
{-# START_FILE test/main.hs #-}
|
|
||||||
{-# 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
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-bin
|
name: yesod-bin
|
||||||
version: 1.4.0.5
|
version: 1.4.0.6
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user