diff --git a/Web/Heroku/Internal.hs b/Web/Heroku/Internal.hs
--- a/Web/Heroku/Internal.hs
+++ b/Web/Heroku/Internal.hs
@@ -27,17 +27,18 @@
                                            Nothing   -> invalid
                                            Just a -> (a, uriPath uri)
       (user,password) = userAndPassword auth
-  in     [
-          (pack "user",     user)
-          -- tail not safe, but should be there on Heroku
-         ,(pack "password", Data.Text.tail password)
-         ,(pack "host",     pack $ uriRegName auth)
-         -- Heroku should use default port
-         -- ,(pack "port",     pack $ uriPort auth)
+  in     [ (pack "user",     user)
+           -- tail not safe, but should be there on Heroku
+         , (pack "password", Data.Text.tail password)
+         , (pack "host",     pack $ uriRegName auth)
+         , (pack "port",     pack $ removeColon $ uriPort auth)
          -- tail not safe but path should always be there
-         ,(pack "dbname",   pack $ Prelude.tail $ path)
+         , (pack "dbname",   pack $ Prelude.tail $ path)
          ]
   where
+    removeColon (':':port) = port
+    removeColon port = port
+
     -- init is not safe, but should be there on Heroku
     userAndPassword :: URIAuth -> (Text, Text)
     userAndPassword = (breakOn $ pack ":") . pack . Prelude.init . uriUserInfo
diff --git a/heroku.cabal b/heroku.cabal
--- a/heroku.cabal
+++ b/heroku.cabal
@@ -1,5 +1,5 @@
 Name:                heroku
-Version:             0.1.1.1
+Version:             0.1.2
 Synopsis:            helpers for deploying to Heroku
 Description:         currently just a parser for DATABASE_URL
 Homepage:            https://github.com/gregwebs/haskell-heroku
@@ -10,7 +10,7 @@
 Category:            Web
 Build-type:          Simple
 
-Cabal-version:       >=1.2
+Cabal-version:       >= 1.8
 
 
 Library
@@ -23,3 +23,11 @@
   Build-depends: base >= 4 && < 5
                , text
                , network
+
+Test-Suite test
+  Type:                 exitcode-stdio-1.0
+  Main-Is:              test.hs
+  Build-depends: base >= 4 && < 5
+               , text
+               , network
+               , hspec
diff --git a/test.hs b/test.hs
new file mode 100644
--- /dev/null
+++ b/test.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Main where
+
+import Web.Heroku
+import Test.Hspec
+
+main :: IO ()
+main = hspec $
+  describe "parseDatabaseUrl" $
+    it "extracts individual items" $
+      parseDatabaseUrl "postgres://db:pass@ec2-1-1-1-1.compute-1.amazonaws.com:1234/db" `shouldBe`
+        [ ("user","db")
+        , ("password","pass")
+        , ("host","ec2-1-1-1-1.compute-1.amazonaws.com")
+        , ("port","1234")
+        , ("dbname","db")
+        ]
