Skip to content

Commit

Permalink
Issue #26: implement Artyom's feedback about RUNTIME_IGNOREDOTFILES
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Dimjašević committed Oct 28, 2019
1 parent 3de7d4b commit e58f63a
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions test/Fencer/Rules/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit e58f63a

Please sign in to comment.