Skip to content

Commit

Permalink
Taught StepTests to accept any HttpServlet as a route
Browse files Browse the repository at this point in the history
  • Loading branch information
JR Boyens committed May 5, 2010
1 parent e538444 commit 705b57a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/com/thinkminimo/step/StepTests.scala
Expand Up @@ -5,7 +5,9 @@ import java.net.URLEncoder.encode
import org.mortbay.jetty.testing.HttpTester
import org.mortbay.jetty.testing.ServletTester
import org.mortbay.jetty.Handler
import org.mortbay.jetty.servlet.ServletHolder
import java.nio.charset.Charset
import javax.servlet.http.HttpServlet

trait StepTests {
implicit def httpTesterToStepHttpTester(t: HttpTester) = new StepHttpTester(t)
Expand Down Expand Up @@ -57,6 +59,8 @@ trait StepTests {
// map a servlet to the path
def route(servlet: Class[_], path: String) = tester.addServlet(servlet, path)

def route(servlet: HttpServlet, path: String) = tester.getContext().addServlet(new ServletHolder(servlet), path)

def routeFilter(filter: Class[_], path: String) = tester.addFilter(filter, path, Handler.DEFAULT)

def get(uri: String)(f: => Unit): Unit = withResponse(httpRequest("GET", uri), f)
Expand Down

0 comments on commit 705b57a

Please sign in to comment.