1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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])
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
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")
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
assert_equal "partial html", @view.render(partial: "test/partial", formats: :html)
assert_equal "partial js", @view.render(partial: "test/partial", formats: [:js])