Permalink
Browse files

Add ScalaTest support.

  • Loading branch information...
1 parent 5616299 commit cbb116e9112eccb348fe89728bc4cd0996abf093 @rossabaker rossabaker committed Mar 7, 2011
Showing with 31 additions and 2 deletions.
  1. +12 −2 pom.xml
  2. +19 −0 src/test/scala/MyScalatraFilterSuite.scala
View
14 pom.xml
@@ -8,6 +8,10 @@
<artifactId>scalatra-maven-prototype</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <scalatra.version>2.0.0.M2</scalatra.version>
+ </properties>
<build>
<finalName>scalatra-maven-prototype</finalName>
@@ -58,10 +62,16 @@
<dependency>
<groupId>org.scalatra</groupId>
<artifactId>scalatra-scalate_2.8.1</artifactId>
- <version>2.0.0.M2</version>
+ <version>${scalatra.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.scalatra</groupId>
+ <artifactId>scalatra-scalatest_2.8.1</artifactId>
+ <version>${scalatra.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5-20081211</version>
@@ -118,4 +128,4 @@
</pluginRepository>
</pluginRepositories>
-</project>
+</project>
@@ -0,0 +1,19 @@
+package net.srirangan
+
+import org.scalatra._
+import org.scalatra.test.scalatest._
+
+import org.junit.runner.RunWith
+import org.scalatest.matchers._
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner]) // makes test run with Maven Surefire
+class MyScalatraFilterSuite extends ScalatraFunSuite with ShouldMatchers {
+ addFilter(classOf[MyScalatraFilter], "/*")
+
+ test("GET / returns status 200") {
+ get("/") {
+ status should equal (200)
+ }
+ }
+}

0 comments on commit cbb116e

Please sign in to comment.