Commits

Pieter Joost van de Sande committed 50370f9

Adds simple spec

Comments (0)

Files changed (2)

 
 resolvers += "twitter-repo" at "http://maven.twttr.com"
 
-libraryDependencies ++= Seq("com.twitter" % "finagle-core" % "1.9.0", "com.twitter" % "finagle-http" % "1.9.0")
+libraryDependencies ++= Seq("com.twitter" % "finagle-core" % "1.9.0", "com.twitter" % "finagle-http" % "1.9.0")

src/main/scala/Web.scala

 import java.net.InetSocketAddress
 import util.Properties
 
+import org.specs.Specification
+import org.specs.mock.Mockito
+
 object Web {
   def main(args: Array[String]) {
     val port = Properties.envOrElse("PORT", "8080").toInt
     response.setContentString("{\"cities\" :[\"San Francisco\", \"Amsterdam\",\"Berlin\",\"New York\"]}")
     Future(response)
   }
-}
+}
+
+class WebTest extends Specification with Mockito {
+  "Cities" should {
+    "have content" in {
+      var request = mock(new HttpRequest)
+
+      var cities = Cities()
+      var f = cities.apply()
+
+      f onSuccess {
+        case response => reponse.getContent().readable() mustEqual true
+      }
+    }
+  }
+}