Last active
January 27, 2016 15:36
-
-
Save kenji0x02/3f990df8e91223df3c5c to your computer and use it in GitHub Desktop.
Play2Authを使ったときのコントローラーテストミニマム
This file contains hidden or 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
package controllers.user | |
import controllers.auth.AuthConfigImpl | |
import org.specs2.mutable._ | |
import play.api.test._ | |
import play.api.test.Helpers._ | |
import jp.t2v.lab.play2.auth.test.Helpers._ | |
class UserTest extends Specification { | |
sequential | |
// Play2AuthのTestを使うための設定 | |
object config extends AuthConfigImpl | |
"list" should { | |
"OK for Administrator" in new WithApplication(FakeApplication()) { | |
// 第二引数はDBのindexを指定 | |
val res = route(FakeRequest(GET, "/user/list").withLoggedIn(config)(1)).get | |
status(res) must equalTo(OK) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
user情報はDBに登録済みとする。