Skip to content

Commit a16298b

Browse files
author
Julien Bille
committed
partial test
1 parent bd3d71e commit a16298b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

project-code/app/org/jba/Mustache.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class JavaMustache extends MustacheAPI{
7171
def render(template: String, data: Any): Html = {
7272
Logger("mustache").debug("Mustache render template " + template)
7373

74-
var mustache = {
74+
val mustache = {
7575
if(Play.isProd) {
7676
val maybeTemplate = mf.compile(template)
7777
if(maybeTemplate == null) {

sample/test/BasicTest.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ class BasicTestSpec extends Specification {
2424
val params = Map('title -> "Title")
2525
val htmlRes = Mustache.render("title", params)
2626
htmlRes.toString.equals("<h3>Title</h3>")
27+
}
28+
29+
"compile with option parameters" in new WithApplication {
30+
val params = Map('title -> Some("Title"))
31+
val htmlRes = Mustache.render("title", params)
32+
htmlRes.toString.equals("<h3>Title</h3>")
2733
}
2834

35+
2936
"wrong template" in new WithApplication {
3037
Mustache.render("title-wrong", Header("Title")) must throwA[Exception]
3138
}
@@ -41,6 +48,5 @@ class BasicTestSpec extends Specification {
4148

4249
Mustache.render("content_partial_item", content).toString must contain("alice")
4350
}
44-
}
45-
51+
}
4652
}

0 commit comments

Comments
 (0)