Add tests for render template/partial with variants option.

This commit is contained in:
Stan Lo 2017-04-14 17:23:25 +08:00
parent a84cfe9340
commit 8feb7c934f
3 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1 @@
<h1>No Comment</h1>

View File

@ -0,0 +1 @@
<h1>Partial with variants</h1>

View File

@ -83,6 +83,10 @@ module RenderTestCases
assert_equal "<h1>Kein Kommentar</h1>", @view.render(template: "comments/empty", locale: [:de]) assert_equal "<h1>Kein Kommentar</h1>", @view.render(template: "comments/empty", locale: [:de])
end end
def test_render_template_with_variants
assert_equal "<h1>No Comment</h1>\n", @view.render(template: "comments/empty", variants: :grid)
end
def test_render_file_with_handlers def test_render_file_with_handlers
assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: [:builder]) assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: [:builder])
assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: :builder) assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: :builder)
@ -170,6 +174,10 @@ module RenderTestCases
assert_equal "partial html", @view.render(partial: "test/partial") assert_equal "partial html", @view.render(partial: "test/partial")
end end
def test_render_partial_with_variants
assert_equal "<h1>Partial with variants</h1>\n", @view.render(partial: "test/partial_with_variants", variants: :grid)
end
def test_render_partial_with_selected_format def test_render_partial_with_selected_format
assert_equal "partial html", @view.render(partial: "test/partial", formats: :html) assert_equal "partial html", @view.render(partial: "test/partial", formats: :html)
assert_equal "partial js", @view.render(partial: "test/partial", formats: [:js]) assert_equal "partial js", @view.render(partial: "test/partial", formats: [:js])