conferer-provider-json 0.1.0.5 → 0.2.0.0
raw patch · 2 files changed
+10/−10 lines, 2 filesdep ~confererPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: conferer
API changes (from Hackage documentation)
Files
conferer-provider-json.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 59d6ea6347a2ac180d4a9357cf59aa29e44483d897a6a781b6b09fe6fcfeb85d+-- hash: 0a256c8de3d8b373065978779d7e08f5bbd48ecd77ebfd2d27d6c63e4ba6f452 name: conferer-provider-json-version: 0.1.0.5+version: 0.2.0.0 synopsis: conferer's provider for reading json files description: Library to abstract the parsing of many haskell config values from different config sources@@ -35,7 +35,7 @@ aeson >=0.10 && <2.0 , base >=4.3 && <5 , bytestring >=0.10 && <0.11- , conferer >=0.1.0.1 && <0.2.0.0+ , conferer >=0.2.0.0 && <0.3.0.0 , directory >=1.2 && <2.0 , text >=1.1 && <1.3 , unordered-containers
test/Conferer/Provider/JSONSpec.hs view
@@ -13,13 +13,13 @@ c <- emptyConfig & addProvider (mkJsonProvider' [aesonQQ| {"postgres": {"url": "some url", "ssl": true}} |]) res <- getKey "postgres.url" c- res `shouldBe` Right "some url"+ res `shouldBe` Just "some url" it "getting an non existing path returns nothing" $ do c <- emptyConfig & addProvider (mkJsonProvider' [aesonQQ| {"postgres": {"url": "some url", "ssl": true}} |]) res <- getKey "some.path" c- res `shouldBe` Left "Key 'some.path' was not found"+ res `shouldBe` Nothing describe "with an array" $ do it "getting a path with number gets the right value" $ do@@ -27,7 +27,7 @@ & addProvider (mkJsonProvider' [aesonQQ| {"key": ["value"]} |]) res <- getKey "key.0" c- res `shouldBe` Right "value"+ res `shouldBe` Just "value" describe "with an object" $ do it "getting an existing path returns nothing" $ do@@ -35,25 +35,25 @@ & addProvider (mkJsonProvider' [aesonQQ| {"key": { "path": "value"}} |]) res <- getKey "key" c- res `shouldBe` Left "Key 'key' was not found"+ res `shouldBe` Nothing describe "with an int" $ do it "getting an existing path returns the right value" $ do c <- emptyConfig & addProvider (mkJsonProvider' [aesonQQ| {"key": 1} |]) res <- getKey "key" c- res `shouldBe` Right "1"+ res `shouldBe` Just "1" describe "with a float" $ do it "getting an existing path returns the right value" $ do c <- emptyConfig & addProvider (mkJsonProvider' [aesonQQ| {"key": 1.2} |]) res <- getKey "key" c- res `shouldBe` Right "1.2"+ res `shouldBe` Just "1.2" describe "with a boolean" $ do it "getting an existing path returns the right value" $ do c <- emptyConfig & addProvider (mkJsonProvider' [aesonQQ| {"key": false} |]) res <- getKey "key" c- res `shouldBe` Right "false"+ res `shouldBe` Just "false"