Skip to content

Instantly share code, notes, and snippets.

@heat
Created August 7, 2015 16:49
Show Gist options
  • Save heat/f29aa3e89ba9460de68d to your computer and use it in GitHub Desktop.
Save heat/f29aa3e89ba9460de68d to your computer and use it in GitHub Desktop.
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.libs.ws._
import play.api.test._
import play.api.test.Helpers._
import scala.concurrent.{ExecutionContext, Await}
@RunWith(classOf[JUnitRunner])
class ApplicationSpec extends Specification {
val ec: ExecutionContext = ExecutionContext.global;
"A WS Request " should {
"Return a 404 not found" in new WithApplication{
// await is from play.api.test.FutureAwaits
val request = WS.url("http://httpbin.org/status/404").get();
val result = Helpers.await(request)
result.status must_==(NOT_FOUND)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment