playframework 2.2 - Play Framework 2.2 - functional test fails with type mismatch -
i've upgraded play 2.2, , since helpers have changed, test isn't compiling anymore.
import org.specs2.mutable.specification import play.api.test._ import play.api.test.helpers._ import play.api.libs.ws._ import play.api.mvc.results._ class applicationspec extends specification { import controllers._ "application" should { "test ws logic" in new withserver { await(ws.url("http://localhost:3333").get()).status must equalto(ok) } } } gives following compile error
type mismatch; [error] found : scala.concurrent.future[play.api.libs.ws.response] [error] required: org.specs2.matcher.matcher[?]
it's name clash between play.api.test.helpers.await , org.specs2.matcher.futurematchers.await.
you refer play helper more explicitly (or rename import):
helpers.await(ws.url("http://localhost:3333").get()).status must equalto(ok) the following better, however, hasn't made documentation yet:
so extend playspecification instead of specification in test:
import org.specs2.mutable.specification import play.api.test._ import play.api.test.helpers._ import play.api.libs.ws._ import play.api.mvc.results._ class applicationspec extends playspecification { import controllers._ "application" should { "test ws logic" in new withserver { await(ws.url("http://localhost:3333").get()).status must equalto(ok) } } }
Comments
Post a Comment