-
Notifications
You must be signed in to change notification settings - Fork 10
/
IntegrationSpec.scala
38 lines (27 loc) · 992 Bytes
/
IntegrationSpec.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package test
import org.specs2.mutable._
import play.api.mvc.{Action, Results}
import play.api.test._
import play.api.test.Helpers._
import scaldi.play.{FakeRouterModule, ScaldiApplicationBuilder}
class IntegrationSpec extends Specification {
"Application" should {
"work from within a browser" in {
running(TestServer(3333, new ScaldiApplicationBuilder().build()), HTMLUNIT) { browser =>
browser.goTo("http://localhost:3333/")
browser.pageSource must contain("Test Page")
}
}
"work from within a browser with fake routes" in {
val fakeRotes = FakeRouterModule {
case ("GET", "/some-url") => Action {
Results.Ok("everything is fine")
}
}
running(TestServer(3333, new ScaldiApplicationBuilder(modules = Seq(fakeRotes)).build()), HTMLUNIT) { browser =>
browser.goTo("http://localhost:3333/some-url")
browser.pageSource must contain("everything is fine")
}
}
}
}