Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
vieux committed Apr 23, 2014
1 parent c04dc39 commit fb5d71d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fixtures/basic/current_layout.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ current }} head
{{ yield }}
{{ current }} foot
20 changes: 20 additions & 0 deletions render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,26 @@ func Test_Render_Layout(t *testing.T) {
expect(t, res.Body.String(), "head\n<h1>jeremy</h1>\n\nfoot\n")
}

func Test_Render_Layout_Current(t *testing.T) {
m := martini.Classic()
m.Use(Renderer(Options{
Directory: "fixtures/basic",
Layout: "current_layout",
}))

// routing
m.Get("/foobar", func(r Render) {
r.HTML(200, "content", "jeremy")
})

res := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/foobar", nil)

m.ServeHTTP(res, req)

expect(t, res.Body.String(), "content head\n<h1>jeremy</h1>\n\ncontent foot\n")
}

func Test_Render_Nested_HTML(t *testing.T) {
m := martini.Classic()
m.Use(Renderer(Options{
Expand Down

0 comments on commit fb5d71d

Please sign in to comment.