Merge branch 'master' of github.com:yesodweb/yesod
This commit is contained in:
commit
a70de71d8e
@ -397,15 +397,15 @@ japaneseMessage NowLoggedIn = "ログインしました"
|
|||||||
japaneseMessage LoginTitle = "ログイン"
|
japaneseMessage LoginTitle = "ログイン"
|
||||||
japaneseMessage PleaseProvideUsername = "ユーザ名を入力してください"
|
japaneseMessage PleaseProvideUsername = "ユーザ名を入力してください"
|
||||||
japaneseMessage PleaseProvidePassword = "パスワードを入力してください"
|
japaneseMessage PleaseProvidePassword = "パスワードを入力してください"
|
||||||
japaneseMessage NoIdentifierProvided = "No email/username provided"
|
japaneseMessage NoIdentifierProvided = "メールアドレス/ユーザ名が入力されていません"
|
||||||
japaneseMessage InvalidEmailAddress = "Invalid email address provided"
|
japaneseMessage InvalidEmailAddress = "メールアドレスが無効です"
|
||||||
japaneseMessage PasswordResetTitle = "Password Reset"
|
japaneseMessage PasswordResetTitle = "パスワードの再設定"
|
||||||
japaneseMessage ProvideIdentifier = "Email or Username"
|
japaneseMessage ProvideIdentifier = "メールアドレスまたはユーザ名"
|
||||||
japaneseMessage SendPasswordResetEmail = "Send password reset email"
|
japaneseMessage SendPasswordResetEmail = "パスワード再設定用メールの送信"
|
||||||
japaneseMessage PasswordResetPrompt = "Enter your e-mail address or username below, and a password reset e-mail will be sent to you."
|
japaneseMessage PasswordResetPrompt = "以下にメールアドレスまたはユーザ名を入力してください。パスワードを再設定するためのメールが送信されます。"
|
||||||
japaneseMessage InvalidUsernamePass = "Invalid username/password combination"
|
japaneseMessage InvalidUsernamePass = "ユーザ名とパスワードの組み合わせが間違っています"
|
||||||
japaneseMessage (IdentifierNotFound ident) =
|
japaneseMessage (IdentifierNotFound ident) =
|
||||||
"「" `mappend` ident `mappend` "」は正しくないログインので、または未入力の項目があります。"
|
ident `mappend` "は登録されていません"
|
||||||
|
|
||||||
finnishMessage :: AuthMessage -> Text
|
finnishMessage :: AuthMessage -> Text
|
||||||
finnishMessage NoOpenID = "OpenID-tunnistetta ei löydy"
|
finnishMessage NoOpenID = "OpenID-tunnistetta ei löydy"
|
||||||
|
|||||||
@ -388,7 +388,7 @@ watchForChanges filesModified hsSourceDirs extraFiles list t = do
|
|||||||
Map.differenceWith compareTimes newList list `Map.union`
|
Map.differenceWith compareTimes newList list `Map.union`
|
||||||
Map.differenceWith compareTimes list newList
|
Map.differenceWith compareTimes list newList
|
||||||
return (haskellFileChanged, newList)
|
return (haskellFileChanged, newList)
|
||||||
else timeout (10000000*t) (takeMVar filesModified) >>
|
else timeout (1000000*t) (takeMVar filesModified) >>
|
||||||
watchForChanges filesModified hsSourceDirs extraFiles list t
|
watchForChanges filesModified hsSourceDirs extraFiles list t
|
||||||
where
|
where
|
||||||
compareTimes x y
|
compareTimes x y
|
||||||
@ -416,7 +416,7 @@ checkCabalFile gpd = case D.condLibrary gpd of
|
|||||||
unless (null unlisted) $ do
|
unless (null unlisted) $ do
|
||||||
putStrLn "WARNING: the following source files are not listed in exposed-modules or other-modules:"
|
putStrLn "WARNING: the following source files are not listed in exposed-modules or other-modules:"
|
||||||
mapM_ putStrLn unlisted
|
mapM_ putStrLn unlisted
|
||||||
when (D.fromString "Application" `notElem` D.exposedModules dLib) $
|
when ("Application" `notElem` (map (last . D.components) $ D.exposedModules dLib)) $
|
||||||
putStrLn "WARNING: no exposed module Application"
|
putStrLn "WARNING: no exposed module Application"
|
||||||
return (hsSourceDirs, dLib)
|
return (hsSourceDirs, dLib)
|
||||||
|
|
||||||
|
|||||||
@ -27,16 +27,17 @@ keter :: String -- ^ cabal command
|
|||||||
-> Bool -- ^ no build?
|
-> Bool -- ^ no build?
|
||||||
-> IO ()
|
-> IO ()
|
||||||
keter cabal noBuild = do
|
keter cabal noBuild = do
|
||||||
mvalue <- decodeFile "config/keter.yaml"
|
ketercfg <- keterConfig
|
||||||
|
mvalue <- decodeFile ketercfg
|
||||||
value <-
|
value <-
|
||||||
case mvalue of
|
case mvalue of
|
||||||
Nothing -> error "No config/keter.yaml found"
|
Nothing -> error "No config/keter.yaml found"
|
||||||
Just (Object value) ->
|
Just (Object value) ->
|
||||||
case Map.lookup "host" value of
|
case Map.lookup "host" value of
|
||||||
Just (String s) | "<<" `T.isPrefixOf` s ->
|
Just (String s) | "<<" `T.isPrefixOf` s ->
|
||||||
error "Please set your hostname in config/keter.yaml"
|
error $ "Please set your hostname in " ++ ketercfg
|
||||||
_ -> return value
|
_ -> return value
|
||||||
Just _ -> error "config/keter.yaml is not an object"
|
Just _ -> error $ ketercfg ++ " is not an object"
|
||||||
|
|
||||||
files <- getDirectoryContents "."
|
files <- getDirectoryContents "."
|
||||||
project <-
|
project <-
|
||||||
@ -48,7 +49,7 @@ keter cabal noBuild = do
|
|||||||
exec <-
|
exec <-
|
||||||
case Map.lookup "exec" value of
|
case Map.lookup "exec" value of
|
||||||
Just (String s) -> return $ F.collapse $ "config" F.</> F.fromText s
|
Just (String s) -> return $ F.collapse $ "config" F.</> F.fromText s
|
||||||
_ -> error "exec not found in config/keter.yaml"
|
_ -> error $ "exec not found in " ++ ketercfg
|
||||||
|
|
||||||
unless noBuild $ do
|
unless noBuild $ do
|
||||||
run cabal ["clean"]
|
run cabal ["clean"]
|
||||||
@ -67,6 +68,12 @@ keter cabal noBuild = do
|
|||||||
Just i -> run "scp" ["-P" ++ show (i :: Int), fp, T.unpack s]
|
Just i -> run "scp" ["-P" ++ show (i :: Int), fp, T.unpack s]
|
||||||
Nothing -> run "scp" [fp, T.unpack s]
|
Nothing -> run "scp" [fp, T.unpack s]
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
where
|
||||||
|
-- Test for alternative config file extension (yaml or yml).
|
||||||
|
keterConfig = do
|
||||||
|
let yml = "config/keter.yml"
|
||||||
|
ymlExists <- doesFileExist yml
|
||||||
|
return $ if ymlExists then yml else "config/keter.yaml"
|
||||||
|
|
||||||
try' :: IO a -> IO (Either SomeException a)
|
try' :: IO a -> IO (Either SomeException a)
|
||||||
try' = try
|
try' = try
|
||||||
|
|||||||
@ -152,6 +152,9 @@ optParser = Options
|
|||||||
keterOptions :: Parser Command
|
keterOptions :: Parser Command
|
||||||
keterOptions = Keter <$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
|
keterOptions = Keter <$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
|
||||||
|
|
||||||
|
defaultRescan :: Int
|
||||||
|
defaultRescan = 10
|
||||||
|
|
||||||
develOptions :: Parser Command
|
develOptions :: Parser Command
|
||||||
develOptions = Devel <$> switch ( long "disable-api" <> short 'd'
|
develOptions = Devel <$> switch ( long "disable-api" <> short 'd'
|
||||||
<> help "Disable fast GHC API rebuilding")
|
<> help "Disable fast GHC API rebuilding")
|
||||||
@ -159,8 +162,10 @@ develOptions = Devel <$> switch ( long "disable-api" <> short 'd'
|
|||||||
<> help "Run COMMAND after rebuild succeeds")
|
<> help "Run COMMAND after rebuild succeeds")
|
||||||
<*> optStr ( long "failure-hook" <> short 'f' <> metavar "COMMAND"
|
<*> optStr ( long "failure-hook" <> short 'f' <> metavar "COMMAND"
|
||||||
<> help "Run COMMAND when rebuild fails")
|
<> help "Run COMMAND when rebuild fails")
|
||||||
<*> option ( long "event-timeout" <> short 't' <> value 1 <> metavar "N"
|
<*> option ( long "event-timeout" <> short 't' <> value defaultRescan <> metavar "N"
|
||||||
<> help "Force rescan of files every N seconds" )
|
<> help ("Force rescan of files every N seconds (default "
|
||||||
|
++ show defaultRescan
|
||||||
|
++ ", use -1 to rely on FSNotify alone)") )
|
||||||
<*> optStr ( long "builddir" <> short 'b'
|
<*> optStr ( long "builddir" <> short 'b'
|
||||||
<> help "Set custom cabal build directory, default `dist'")
|
<> help "Set custom cabal build directory, default `dist'")
|
||||||
<*> many ( strOption ( long "ignore" <> short 'i' <> metavar "DIR"
|
<*> many ( strOption ( long "ignore" <> short 'i' <> metavar "DIR"
|
||||||
|
|||||||
@ -28,7 +28,9 @@ module Yesod.Test
|
|||||||
yesodSpec
|
yesodSpec
|
||||||
, YesodSpec
|
, YesodSpec
|
||||||
, yesodSpecWithSiteGenerator
|
, yesodSpecWithSiteGenerator
|
||||||
|
, yesodSpecApp
|
||||||
, YesodExample
|
, YesodExample
|
||||||
|
, YesodExampleData(..)
|
||||||
, YesodSpecTree (..)
|
, YesodSpecTree (..)
|
||||||
, ydescribe
|
, ydescribe
|
||||||
, yit
|
, yit
|
||||||
@ -125,7 +127,7 @@ import Data.Time.Clock (getCurrentTime)
|
|||||||
|
|
||||||
-- | The state used in a single test case defined using 'yit'
|
-- | The state used in a single test case defined using 'yit'
|
||||||
--
|
--
|
||||||
-- Since 1.2.0
|
-- Since 1.2.4
|
||||||
data YesodExampleData site = YesodExampleData
|
data YesodExampleData site = YesodExampleData
|
||||||
{ yedApp :: !Application
|
{ yedApp :: !Application
|
||||||
, yedSite :: !site
|
, yedSite :: !site
|
||||||
@ -234,6 +236,27 @@ yesodSpecWithSiteGenerator getSiteAction yspecs =
|
|||||||
, yedResponse = Nothing
|
, yedResponse = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | Same as yesodSpec, but instead of taking a site it
|
||||||
|
-- takes an action which produces the 'Application' for each test.
|
||||||
|
-- This lets you use your middleware from makeApplication
|
||||||
|
yesodSpecApp :: YesodDispatch site
|
||||||
|
=> site
|
||||||
|
-> IO Application
|
||||||
|
-> YesodSpec site
|
||||||
|
-> Hspec.Spec
|
||||||
|
yesodSpecApp site getApp yspecs =
|
||||||
|
Core.fromSpecList $ map unYesod $ execWriter yspecs
|
||||||
|
where
|
||||||
|
unYesod (YesodSpecGroup x y) = Core.SpecGroup x $ map unYesod y
|
||||||
|
unYesod (YesodSpecItem x y) = Core.it x $ do
|
||||||
|
app <- getApp
|
||||||
|
ST.evalStateT y YesodExampleData
|
||||||
|
{ yedApp = app
|
||||||
|
, yedSite = site
|
||||||
|
, yedCookies = M.empty
|
||||||
|
, yedResponse = Nothing
|
||||||
|
}
|
||||||
|
|
||||||
-- | Describe a single test that keeps cookies, and a reference to the last response.
|
-- | Describe a single test that keeps cookies, and a reference to the last response.
|
||||||
yit :: String -> YesodExample site () -> YesodSpec site
|
yit :: String -> YesodExample site () -> YesodSpec site
|
||||||
yit label example = tell [YesodSpecItem label example]
|
yit label example = tell [YesodSpecItem label example]
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
name: yesod-test
|
name: yesod-test
|
||||||
version: 1.2.3.2
|
version: 1.2.5
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Nubis <nubis@woobiz.com.ar>
|
author: Nubis <nubis@woobiz.com.ar>
|
||||||
maintainer: Nubis <nubis@woobiz.com.ar>, Michael Snoyman
|
maintainer: Michael Snoyman, Greg Weber, Nubis <nubis@woobiz.com.ar>
|
||||||
synopsis: integration testing for WAI/Yesod Applications
|
synopsis: integration testing for WAI/Yesod Applications
|
||||||
category: Web, Yesod, Testing
|
category: Web, Yesod, Testing
|
||||||
stability: Experimental
|
stability: Experimental
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user