aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-01-22 20:58:09 +0100
committerPacien TRAN-GIRARD2015-01-22 20:58:09 +0100
commit2f6780969318c08c7a0a0e8e52a7dad33ff53786 (patch)
tree893d9356b0fd02b40124712bfa88128f02cd7b53 /test
downloadminibay-2f6780969318c08c7a0a0e8e52a7dad33ff53786.tar.gz
Bootstrap Play Scala project
Diffstat (limited to 'test')
-rw-r--r--test/ApplicationSpec.scala30
-rw-r--r--test/IntegrationSpec.scala24
2 files changed, 54 insertions, 0 deletions
diff --git a/test/ApplicationSpec.scala b/test/ApplicationSpec.scala
new file mode 100644
index 0000000..6e20bd5
--- /dev/null
+++ b/test/ApplicationSpec.scala
@@ -0,0 +1,30 @@
1import org.specs2.mutable._
2import org.specs2.runner._
3import org.junit.runner._
4
5import play.api.test._
6import play.api.test.Helpers._
7
8/**
9 * Add your spec here.
10 * You can mock out a whole application including requests, plugins etc.
11 * For more information, consult the wiki.
12 */
13@RunWith(classOf[JUnitRunner])
14class ApplicationSpec extends Specification {
15
16 "Application" should {
17
18 "send 404 on a bad request" in new WithApplication{
19 route(FakeRequest(GET, "/boum")) must beNone
20 }
21
22 "render the index page" in new WithApplication{
23 val home = route(FakeRequest(GET, "/")).get
24
25 status(home) must equalTo(OK)
26 contentType(home) must beSome.which(_ == "text/html")
27 contentAsString(home) must contain ("Your new application is ready.")
28 }
29 }
30}
diff --git a/test/IntegrationSpec.scala b/test/IntegrationSpec.scala
new file mode 100644
index 0000000..652edde
--- /dev/null
+++ b/test/IntegrationSpec.scala
@@ -0,0 +1,24 @@
1import org.specs2.mutable._
2import org.specs2.runner._
3import org.junit.runner._
4
5import play.api.test._
6import play.api.test.Helpers._
7
8/**
9 * add your integration spec here.
10 * An integration test will fire up a whole play application in a real (or headless) browser
11 */
12@RunWith(classOf[JUnitRunner])
13class IntegrationSpec extends Specification {
14
15 "Application" should {
16
17 "work from within a browser" in new WithBrowser {
18
19 browser.goTo("http://localhost:" + port)
20
21 browser.pageSource must contain("Your new application is ready.")
22 }
23 }
24}