From 066f499a28168b5212dae47b0ac4c0bf0acd122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Dimja=C5=A1evi=C4=87?= Date: Mon, 28 Oct 2019 16:18:22 +0100 Subject: [PATCH] Issue #26: changes the dot-directory test per Artyom's feedback --- test/Fencer/Rules/Test.hs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/Fencer/Rules/Test.hs b/test/Fencer/Rules/Test.hs index c27ee39..d99e305 100644 --- a/test/Fencer/Rules/Test.hs +++ b/test/Fencer/Rules/Test.hs @@ -35,16 +35,14 @@ tests = testGroup "Rule tests" -- produces expected result. expectLoadRules :: "ignoreDotFiles" :! Bool - -> "dirTemplate" :! String -> "files" :! [(FilePath, Text)] -> "result" :! [DomainDefinition] -> Assertion expectLoadRules (arg #ignoreDotFiles -> ignoreDotFiles) - (arg #dirTemplate -> dirTemplate) (arg #files -> files) (arg #result -> result) = - Temp.withSystemTempDirectory dirTemplate $ \tempDir -> do + Temp.withSystemTempDirectory "fencer-config" $ \tempDir -> do forM_ files $ \(path, txt) -> do let (dir, file) = splitFileName path createDirectoryIfMissing True (tempDir dir) @@ -62,7 +60,6 @@ test_rulesLoadRulesYaml = testCase "Rules are loaded from YAML files" $ expectLoadRules (#ignoreDotFiles True) - (#dirTemplate "fencer-config") (#files [ ("config1.yml", domain1Text) , ("config2.yaml", domain2Text) ] @@ -76,10 +73,9 @@ test_rulesLoadRulesDotDirectory = testCase "Rules are loaded from a dot-directory" $ expectLoadRules (#ignoreDotFiles True) - (#dirTemplate ".fencer-config") (#files - [ ("config1.yml", domain1Text) - , ("config2.yaml", domain2Text) ] + [ (".domain1/config1.yml", domain1Text) + , (".domain2/config2.yaml", domain2Text) ] ) (#result [domain1, domain2]) @@ -92,7 +88,6 @@ test_rulesLoadRulesNonYaml = testCase "Rules are loaded from non-YAML files" $ expectLoadRules (#ignoreDotFiles True) - (#dirTemplate "fencer-config") (#files [ ("config1.bin", domain1Text) , ("config2", domain2Text) ] @@ -107,7 +102,6 @@ test_rulesLoadRulesRecursively = testCase "Rules are loaded recursively" $ expectLoadRules (#ignoreDotFiles True) - (#dirTemplate "fencer-config") (#files [ ("domain1/config.yml", domain1Text) , ("domain2/config/config.yml", domain2Text) ]