summaryrefslogtreecommitdiff
path: root/example/decorated2/app
diff options
context:
space:
mode:
Diffstat (limited to 'example/decorated2/app')
-rw-r--r--example/decorated2/app/src/Decorated2.scala4
-rw-r--r--example/decorated2/app/test/src/ExampleTests.scala4
2 files changed, 4 insertions, 4 deletions
diff --git a/example/decorated2/app/src/Decorated2.scala b/example/decorated2/app/src/Decorated2.scala
index 20526b7..fa4b1c5 100644
--- a/example/decorated2/app/src/Decorated2.scala
+++ b/example/decorated2/app/src/Decorated2.scala
@@ -4,12 +4,12 @@ object Decorated2 extends cask.MainRoutes{
override def toString = "[haoyi]"
}
class loggedIn extends cask.Decorator {
- def wrapFunction(ctx: cask.Request, delegate: Delegate): Returned = {
+ def wrapFunction(ctx: cask.Request, delegate: Delegate): OuterReturned = {
delegate(Map("user" -> new User()))
}
}
class withExtra extends cask.Decorator {
- def wrapFunction(ctx: cask.Request, delegate: Delegate): Returned = {
+ def wrapFunction(ctx: cask.Request, delegate: Delegate): OuterReturned = {
delegate(Map("extra" -> 31337))
}
}
diff --git a/example/decorated2/app/test/src/ExampleTests.scala b/example/decorated2/app/test/src/ExampleTests.scala
index 7fec82a..4343097 100644
--- a/example/decorated2/app/test/src/ExampleTests.scala
+++ b/example/decorated2/app/test/src/ExampleTests.scala
@@ -4,7 +4,7 @@ import io.undertow.Undertow
import utest._
object ExampleTests extends TestSuite{
- def test[T](example: cask.main.BaseMain)(f: String => T): T = {
+ def withServer[T](example: cask.main.BaseMain)(f: String => T): T = {
val server = Undertow.builder
.addHttpListener(8080, "localhost")
.setHandler(example.defaultHandler)
@@ -17,7 +17,7 @@ object ExampleTests extends TestSuite{
}
val tests = Tests{
- 'Decorated2 - test(Decorated2){ host =>
+ test("Decorated2") - withServer(Decorated2){ host =>
requests.get(s"$host/hello/woo").text() ==> "woo31337"
requests.get(s"$host/internal-extra/goo").text() ==> "goo[haoyi]31337"
requests.get(s"$host/ignore-extra/boo").text() ==> "boo[haoyi]"