@@ -22,7 +22,9 @@ spec = do
22 it "shows the path of a BaseUrl" $ do
22 it "shows the path of a BaseUrl" $ do
23 showBaseUrl (BaseUrl Http "foo.com" 80 "api") `shouldBe` "http://foo.com/api"
23 showBaseUrl (BaseUrl Http "foo.com" 80 "api") `shouldBe` "http://foo.com/api"
24 it "shows the path of an https BaseUrl" $ do
24 it "shows the path of an https BaseUrl" $ do
25− showBaseUrl (BaseUrl Https "foo.com" 80 "api") `shouldBe` "https://foo.com/api"
25+ showBaseUrl (BaseUrl Https "foo.com" 443 "api") `shouldBe` "https://foo.com/api"
26+ it "handles leading slashes in path" $ do
27+ showBaseUrl (BaseUrl Https "foo.com" 443 "/api") `shouldBe` "https://foo.com/api"
27 describe "httpBaseUrl" $ do
29 describe "httpBaseUrl" $ do
28 it "allows to construct default http BaseUrls" $ do
30 it "allows to construct default http BaseUrls" $ do
@@ -34,8 +36,8 @@ spec = do
34 deepseq (fmap show (parse string )) True
36 deepseq (fmap show (parse string )) True
36 it "is the inverse of showBaseUrl" $ do
38 it "is the inverse of showBaseUrl" $ do
37− property $ \ baseUrl ->
39+ property $ \ baseUrl -> counterexample (showBaseUrl baseUrl) $
38− counterexample (showBaseUrl baseUrl) $ parse (showBaseUrl baseUrl) === Just baseUrl
40+ parse (showBaseUrl baseUrl) === Just baseUrl
40 context "trailing slashes" $ do
42 context "trailing slashes" $ do
41 it "allows trailing slashes" $ do
43 it "allows trailing slashes" $ do
@@ -55,7 +57,7 @@ spec = do
55 parse "http://foo.com/api" `shouldBe` Just (BaseUrl Http "foo.com" 80 "api")
57 parse "http://foo.com/api" `shouldBe` Just (BaseUrl Http "foo.com" 80 "api")
57 it "rejects ftp urls" $ do
59 it "rejects ftp urls" $ do
58− (parse "ftp://foo.com") `shouldBe` Nothing
60+ parse "ftp://foo.com" `shouldBe` Nothing
60instance Arbitrary BaseUrl where
62instance Arbitrary BaseUrl where
61 arbitrary = BaseUrl <$>
63 arbitrary = BaseUrl <$>