Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created January 18, 2012 20:00
Show Gist options
  • Save joegaudet/1635191 to your computer and use it in GitHub Desktop.
Save joegaudet/1635191 to your computer and use it in GitHub Desktop.
@RunWith(classOf[JUnitRunner])
class MatygoAuthenticationTest extends WordSpec with ScalatraSuite with ShouldMatchers with MatygoAuthenticationScaffolding with MatygoControllerTestHelper {
class MockController extends MatygoController with MatygoAuthentication {
get("/login") {
println("Hello hello")
setSession(User.find(params("userId")))
println(cookies("MatygoSession"))
}
}
"The MatygoAuthentication trait" when {
addFilter(new MockController, "/*")
"setting the session string" should {
"have a cookieString value" in {
session {
get("/login", "userId" -> user1.get.id.toString) {
val cookie = response.getHeader("Set-Cookie")
println(cookie)
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment