You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the testing futures with specs2, if one is using play2.4 and also specs3.5, in order to be able to use the await method when testing futures, one should import the specs2 execution environment and add that to each block implicitly:
importorg.specs2.matcher.Matchersimportorg.specs2.mutable.Specificationimportorg.specs2.time.NoTimeConversionsimportscala.concurrent.duration._importorg.specs2.concurrent.ExecutionEnvclassAuthenticationServiceSpecextendsSpecificationwithMatcherswithNoTimeConversions {
"The AuthenticationService" should {
valservice:AuthenticationService=newDummyAuthenticationService"correctly authenticate Bob Marley" in { implicitee: ExecutionEnv=>
service.authenticateUser("bob@marley.org", "secret") must beEqualTo (AuthenticationSuccessful).await(1, 200.millis)
}
"not authenticate Ziggy Marley" in { implicitee: ExecutionEnv=>
service.authenticateUser("ziggy@marley.org", "secret") must beEqualTo (AuthenticationUnsuccessful).await(1, 500.millis)
}
"fail if it takes too long" in { implicitee: ExecutionEnv=>
service.authenticateUser("jimmy@hendrix.com", "secret") must throwA[RuntimeException].await(1, 700.millis)
}
}
}
The text was updated successfully, but these errors were encountered:
For the testing futures with specs2, if one is using play2.4 and also specs3.5, in order to be able to use the await method when testing futures, one should import the specs2 execution environment and add that to each block implicitly:
The text was updated successfully, but these errors were encountered: