diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-07 03:53:05 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-01-07 03:53:05 +0400 |
commit | 6e77e14e2c011760eccc9d6989cd229420bdc741 (patch) | |
tree | 43db9de85968af0bffdc6c6b5714963b75df9a69 /tests/Network | |
parent | 2812bdadb55e1ca7a1e5685f3fb2dafe19259970 (diff) |
Allow to pass options from outside
Diffstat (limited to 'tests/Network')
-rw-r--r-- | tests/Network/KRPCSpec.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/Network/KRPCSpec.hs b/tests/Network/KRPCSpec.hs index 7f5b2794..e73b1ec0 100644 --- a/tests/Network/KRPCSpec.hs +++ b/tests/Network/KRPCSpec.hs | |||
@@ -20,18 +20,21 @@ handlers = | |||
20 | instance MonadLogger IO where | 20 | instance MonadLogger IO where |
21 | monadLoggerLog _ _ _ _ = return () | 21 | monadLoggerLog _ _ _ _ = return () |
22 | 22 | ||
23 | opts :: Options | ||
24 | opts = def { optQueryTimeout = 1 } | ||
25 | |||
23 | spec :: Spec | 26 | spec :: Spec |
24 | spec = do | 27 | spec = do |
25 | describe "query" $ do | 28 | describe "query" $ do |
26 | it "run handlers" $ do | 29 | it "run handlers" $ do |
27 | let int = 0xabcd :: Int | 30 | let int = 0xabcd :: Int |
28 | (withManager servAddr handlers $ runReaderT $ do | 31 | (withManager opts servAddr handlers $ runReaderT $ do |
29 | listen | 32 | listen |
30 | query servAddr (Echo int)) | 33 | query servAddr (Echo int)) |
31 | `shouldReturn` Echo int | 34 | `shouldReturn` Echo int |
32 | 35 | ||
33 | it "throw timeout exception" $ do | 36 | it "throw timeout exception" $ do |
34 | (withManager servAddr handlers $ runReaderT $ do | 37 | (withManager opts servAddr handlers $ runReaderT $ do |
35 | query servAddr (Echo (0xabcd :: Int)) | 38 | query servAddr (Echo (0xabcd :: Int)) |
36 | ) | 39 | ) |
37 | `shouldThrow` (== KError GenericError "timeout expired" "0") | 40 | `shouldThrow` (== KError GenericError "timeout expired" "0") |