Skip to content

Commit

Permalink
Fix faulty flash map test. Main code unaffected.
Browse files Browse the repository at this point in the history
Flash maps are only swept if the outermost handler says to do so.
  • Loading branch information
rossabaker committed Jun 29, 2012
1 parent 7b940f7 commit cf76b02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/src/test/scala/org/scalatra/FlashMapSupportTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ class FlashMapSupportTestServlet extends ScalatraServlet with FlashMapSupport {
}

get("/unused") {}

override def sweepUnusedFlashEntries(req: HttpServletRequest) = req.getParameter("sweep") match {
case null => false
case x => x.toBoolean
}
}

class FlashMapSupportSecondTestServlet extends ScalatraServlet with FlashMapSupport {
Expand All @@ -36,6 +31,11 @@ class FlashMapSupportTestFilter extends ScalatraFilter with FlashMapSupport {
get("/filter") {
flash.get("message") foreach { x => response.setHeader("message", x.toString) }
}

override def sweepUnusedFlashEntries(req: HttpServletRequest) = req.getParameter("sweep") match {
case null => false
case x => x.toBoolean
}
}

class FlashMapSupportTest extends ScalatraFunSuite {
Expand Down Expand Up @@ -102,7 +102,7 @@ class FlashMapSupportTest extends ScalatraFunSuite {
get("/unused", "sweep" -> "true") {}

get("/message") {
header("message") should equal ("posted")
header("message") should equal (null)
}
}
}
Expand Down

0 comments on commit cf76b02

Please sign in to comment.