From e58f63a425b8da925acd3e356da4f1fe2aeaa877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Dimja=C5=A1evi=C4=87?= Date: Mon, 28 Oct 2019 16:38:32 +0100 Subject: [PATCH] Issue #26: implement Artyom's feedback about RUNTIME_IGNOREDOTFILES --- test/Fencer/Rules/Test.hs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/test/Fencer/Rules/Test.hs b/test/Fencer/Rules/Test.hs index 61d226e..961e093 100644 --- a/test/Fencer/Rules/Test.hs +++ b/test/Fencer/Rules/Test.hs @@ -20,7 +20,6 @@ import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (assertEqual, Assertion, testCase) import Fencer.Rules -import Fencer.Settings (getSettingsFromEnvironment, settingsIgnoreDotFiles) import Fencer.Types @@ -86,19 +85,13 @@ test_rulesLoadRulesDotDirectory = test_rulesLoadRulesRUNTIME_IGNOREDOTFILES :: TestTree test_rulesLoadRulesRUNTIME_IGNOREDOTFILES = testCase "Rules are not loaded from a dot-file" $ do - setEnv "RUNTIME_IGNOREDOTFILES" "true" - setEnv "RUNTIME_SUBDIRECTORY" "sub" -- this value will not be used anyway - settings <- getSettingsFromEnvironment - Temp.withSystemTempDirectory "fencer-config" $ \tempDir -> do - TIO.writeFile (tempDir "config1.yml") domain1Text - TIO.writeFile (tempDir ".config2.yaml") domain2Text - definitions <- - loadRulesFromDirectory - (#directory tempDir) - (#ignoreDotFiles $ settingsIgnoreDotFiles settings) - assertEqual "RUNTIME_IGNOREDOTFILES not respected!" - [domain1] - definitions + expectLoadRules + (#ignoreDotFiles True) + (#files + [ ("config1.yml", domain1Text) + , ("dir/.config2.yaml", domain2Text) ] + ) + (#result [domain1]) -- | Test that 'loadRulesFromDirectory' loads rules from all files, not just -- YAML files.