I want to test a WS client with a fake server like it's explained in the Play 2.4 documentation here : http://ift.tt/1B0ToHl
But I'm doing DI with Scaldi and i'm not able to adapt the Play's documentation code to use Scaldi.
Can someone help me ?
The code to adapt is mostly this (come from the Play doc) :
"GitHubClient" should {
"get all repositories" in {
Server.withRouter() {
case GET(p"/repositories") => Action {
Results.Ok(Json.arr(Json.obj("full_name" -> "octocat/Hello-World")))
}
} { implicit port =>
WsTestClient.withClient { client =>
val result = Await.result(
new GitHubClient(client, "").repositories(), 10.seconds)
result must_== Seq("octocat/Hello-World")
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire