From 5ab24105251b0d6f31056739ce9938c565983e72 Mon Sep 17 00:00:00 2001 From: Juha Paananen Date: Wed, 23 Nov 2011 13:38:00 +0200 Subject: [PATCH] add fucnctional spec --- src/main/g8/build.sbt | 1 + .../scala/spike/scalatra/FunctionalSpec.scala | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/main/g8/src/test/scala/spike/scalatra/FunctionalSpec.scala diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt index 725f7ff..05839ef 100755 --- a/src/main/g8/build.sbt +++ b/src/main/g8/build.sbt @@ -11,6 +11,7 @@ seq(webSettings :_*) libraryDependencies ++= Seq( "org.scalatra" %% "scalatra" % "2.0.1", "org.scalatra" %% "scalatra-scalate" % "2.0.1", + "org.scalatra" %% "scalatra-specs2" % "2.0.1", "net.liftweb" %% "lift-json" % "2.4-M4", "org.specs2" %% "specs2" % "1.6.1" % "test", "org.specs2" %% "specs2-scalaz-core" % "6.0.1" % "test", diff --git a/src/main/g8/src/test/scala/spike/scalatra/FunctionalSpec.scala b/src/main/g8/src/test/scala/spike/scalatra/FunctionalSpec.scala new file mode 100644 index 0000000..8c03121 --- /dev/null +++ b/src/main/g8/src/test/scala/spike/scalatra/FunctionalSpec.scala @@ -0,0 +1,18 @@ +package spike.scalatra + +import org.specs2.mutable._ +import org.scalatra.test.specs2.MutableScalatraSpec +import javax.servlet.http.{HttpServlet, HttpServletRequest, HttpServletResponse} + +class FunctionalSpec extends MutableScalatraSpec { + args(sequential=true) + addServlet(new RestServlet, "/*") + + "get user" should { + "return user info" in { + get("/users/1") { + body must_== """{"name":"john","age":30}""" + } + } + } +}