Created
August 9, 2011 14:19
-
-
Save rossabaker/1134153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.scalatra._ | |
import org.scalatra.test.scalatest._ | |
import org.scalatest.matchers._ | |
class LarsTest extends ScalatraFunSuite with ShouldMatchers { | |
addServlet(new ScalatraServlet with CookieSupport { | |
post("/") { | |
cookies.update("foo", "bar") | |
redirect(request.getContextPath) | |
} | |
delete("/") { | |
val token = cookies.get("foo") | |
if (token.isDefined) { | |
response.setHeader("X-Foo-Is-Defined", "true") | |
} | |
status(204) | |
} | |
}, "/*") | |
test("cookie is defined") { | |
session { | |
post("/") { | |
status should equal (302) | |
} | |
delete("/") { | |
status should equal (204) | |
header("X-Foo-Is-Defined") should equal ("true") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment