diff --git a/yesod-test/README.md b/yesod-test/README.md index 23b81daf..6a34bea7 100644 --- a/yesod-test/README.md +++ b/yesod-test/README.md @@ -38,7 +38,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app. mySuite = do describe "Basic navigation and assertions" $ do it "Gets a page that has a form, with auto generated fields and token" $ do - doGet_ "url/of/page/with/form" -- Load a page + get_ "url/of/page/with/form" -- Load a page statusIs 200 -- Assert the status was success bodyContains "Hello Person" -- Assert any part of the document contains some text. @@ -48,7 +48,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app. htmlAllContain "h1#mainTitle" "Sign Up Now!" -- All matches have some text -- Performs the post using the current page to extract field values: - doPost "url/to/post/to" $ do + post "url/to/post/to" $ do addNonce -- Add the _nonce field with the currently shown value -- Lookup field by the text on the labels pointing to them. @@ -57,7 +57,7 @@ This is the helloworld and kitchen sink. In this case for testing a yesod app. byLabel "Confirm:" "secret" it "Sends another form, this one has a file" $ do - doPost "url/to/post/file/to" $ do + post "url/to/post/file/to" $ do -- You can add files this easy, you still have to provide the mime type manually though. addFile "file_field_name" "path/to/local/file" "image/jpeg" diff --git a/yesod-test/yesod-test.cabal b/yesod-test/yesod-test.cabal index 293839a5..982d91c4 100644 --- a/yesod-test/yesod-test.cabal +++ b/yesod-test/yesod-test.cabal @@ -4,7 +4,7 @@ license: BSD3 license-file: LICENSE author: Nubis maintainer: Nubis -synopsis: Behaviour Oriented integration Testing for Yesod Applications +synopsis: integration testing for WAI/Yesod Applications category: Web, Yesod, Testing stability: Experimental cabal-version: >= 1.6 diff --git a/yesod/Scaffolding/Scaffolder.hs b/yesod/Scaffolding/Scaffolder.hs index d386c203..e4add9e3 100644 --- a/yesod/Scaffolding/Scaffolder.hs +++ b/yesod/Scaffolding/Scaffolder.hs @@ -199,7 +199,7 @@ scaffold = do when useTests $ do mkDir "tests" - writeFile' "tests/main.hs" $(codegen "tests_main.hs") + writeFile' "tests/main.hs" $(codegen "tests/main.hs") S.writeFile (dir ++ "/static/js/modernizr.js") $(runIO (S.readFile "scaffold/static/js/modernizr.js.cg") >>= \bs -> diff --git a/yesod/scaffold/cabal_test_suite.cg b/yesod/scaffold/cabal_test_suite.cg index 806b57b6..a6b5eae2 100644 --- a/yesod/scaffold/cabal_test_suite.cg +++ b/yesod/scaffold/cabal_test_suite.cg @@ -16,27 +16,4 @@ test-suite integration-tests FlexibleContexts build-depends: base >= 4 && < 5 - , yesod >= 0.10 && < 0.11 - , yesod-core >= 0.10 && < 0.11 - , yesod-auth >= 0.8 && < 0.9 - , yesod-static >= 0.10 && < 0.11 - , yesod-default >= 0.6 && < 0.7 - , yesod-form >= 0.4 && < 0.5 , yesod-test >= 0.1 && < 0.2 - , mime-mail >= 0.3.0.3 && < 0.5 - , clientsession >= 0.7.3 && < 0.8 - , bytestring >= 0.9 && < 0.10 - , text >= 0.11 && < 0.12 - , persistent >= 0.7 && < 0.8 - , persistent-sqlite >= 0.7 && < 0.8 - , template-haskell - , hamlet >= 0.10 && < 0.11 - , shakespeare-css >= 0.10 && < 0.11 - , shakespeare-js >= 0.10 && < 0.11 - , shakespeare-text >= 0.10 && < 0.11 - , hjsmin >= 0.0.14 && < 0.1 - , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.0 && < 1.1 - , yaml >= 0.5 && < 0.6 - , http-conduit >= 1.1 && < 1.2 - , haskell98 diff --git a/yesod/scaffold/templates/homepage.hamlet.cg b/yesod/scaffold/templates/homepage.hamlet.cg index 07f2084b..ae0f27f7 100644 --- a/yesod/scaffold/templates/homepage.hamlet.cg +++ b/yesod/scaffold/templates/homepage.hamlet.cg @@ -1,13 +1,10 @@

_{MsgHello} -

Now that you have a working project you should use the - Yesod book to learn more. - -

- You can also use this scaffolded site to explore some basic concepts, these are - the main things to look at: -

    +
  1. Now that you have a working project you should use the # + Yesod book to learn more. + You can also use this scaffolded site to explore some basic concepts. +
  2. This page was generated by the #{handlerName} handler in Handler/Root.hs. diff --git a/yesod/scaffold/templates/homepage.julius.cg b/yesod/scaffold/templates/homepage.julius.cg index d636ce89..efae7990 100644 --- a/yesod/scaffold/templates/homepage.julius.cg +++ b/yesod/scaffold/templates/homepage.julius.cg @@ -1 +1 @@ -document.getElementById("#{h2id}").innerHTML = "Added from JavaScript."; +document.getElementById("#{aDomId}").innerHTML = "This text was added by the Javascript part of the homepage widget."; diff --git a/yesod/scaffold/tests_main.hs.cg b/yesod/scaffold/tests/main.hs.cg similarity index 90% rename from yesod/scaffold/tests_main.hs.cg rename to yesod/scaffold/tests/main.hs.cg index 596ed2a5..a9e8e47b 100644 --- a/yesod/scaffold/tests_main.hs.cg +++ b/yesod/scaffold/tests/main.hs.cg @@ -12,19 +12,19 @@ import qualified Database.Persist.Store import Database.Persist.GenericSql (runMigration) import Yesod.Default.Config import Yesod.Test -import Network.HTTP.Conduit (newManagerIO) +import Network.HTTP.Conduit (newManager, def) import Application() main :: IO a main = do conf <- loadConfig $ (configSettings Testing) { csParseExtra = parseExtra } - manager <- newManagerIO 10 + manager <- newManager def logger <- defaultDevelopmentLogger dbconf <- withYamlEnvironment "config/~dbConfigFile~.yml" (appEnv conf) Database.Persist.Store.loadConfig s <- static Settings.staticDir p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)~runMigration~ - app <- toWaiAppPlain $ ~sitearg~ conf logger s p manager + app <- toWaiAppPlain $ ~sitearg~ conf logger s p manager dbconf runTests app p allTests allTests :: Specs diff --git a/yesod/yesod.cabal b/yesod/yesod.cabal index 1fd725ba..37653aee 100644 --- a/yesod/yesod.cabal +++ b/yesod/yesod.cabal @@ -19,46 +19,49 @@ homepage: http://www.yesodweb.com/ extra-source-files: input/*.cg - scaffold/templates/default-layout.lucius.cg - scaffold/templates/homepage.lucius.cg scaffold/Model.hs.cg - scaffold/Import.hs.cg - scaffold/Foundation.hs.cg scaffold/LICENSE.cg + scaffold/project.cabal.cg scaffold/mongoDBConnPool.cg - scaffold/tiny/Import.hs.cg - scaffold/tiny/Foundation.hs.cg + scaffold/main.hs.cg + scaffold/static/js/modernizr.js.cg + scaffold/postgresqlConnPool.cg + scaffold/Foundation.hs.cg scaffold/tiny/project.cabal.cg + scaffold/tiny/Foundation.hs.cg + scaffold/tiny/Import.hs.cg + scaffold/tiny/Settings.hs.cg scaffold/tiny/Application.hs.cg scaffold/tiny/config/routes.cg - scaffold/tiny/Settings.hs.cg - scaffold/templates/normalize.lucius.cg - scaffold/postgresqlConnPool.cg scaffold/sqliteConnPool.cg + scaffold/cabal_test_suite.cg + scaffold/Import.hs.cg scaffold/.ghci.cg - scaffold/project.cabal.cg + scaffold/tests/main.hs.cg + scaffold/Settings.hs.cg + scaffold/Settings/StaticFiles.hs.cg scaffold/Application.hs.cg - scaffold/templates/homepage.julius.cg - scaffold/templates/homepage.hamlet.cg - scaffold/templates/default-layout.hamlet.cg - scaffold/templates/default-layout-wrapper.hamlet.cg scaffold/deploy/Procfile.cg - scaffold/main.hs.cg - scaffold/devel.hs.cg + scaffold/templates/homepage.hamlet.cg + scaffold/templates/default-layout.lucius.cg + scaffold/templates/default-layout.hamlet.cg + scaffold/templates/homepage.julius.cg + scaffold/templates/default-layout-wrapper.hamlet.cg + scaffold/templates/normalize.lucius.cg + scaffold/templates/boilerplate-wrapper.hamlet.cg + scaffold/templates/homepage.lucius.cg scaffold/Handler/Root.hs.cg + scaffold/messages/en.msg.cg scaffold/config/models.cg + scaffold/config/mysql.yml.cg scaffold/config/sqlite.yml.cg scaffold/config/settings.yml.cg scaffold/config/favicon.ico.cg scaffold/config/postgresql.yml.cg - scaffold/config/mysql.yml.cg - scaffold/config/mongoDB.yml.cg scaffold/config/routes.cg scaffold/config/robots.txt.cg - scaffold/Settings.hs.cg - scaffold/Settings/StaticFiles.hs.cg - scaffold/messages/en.msg.cg - scaffold/static/js/modernizr.js.cg + scaffold/config/mongoDB.yml.cg + scaffold/devel.hs.cg flag ghc7