aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-05-01 21:44:21 +0200
committerGitHub <noreply@github.com>2017-05-01 21:44:21 +0200
commit61de2e976405b3306ffa20f1b7e903ed21682483 (patch)
tree97c383b0455d8f0a7d4ac19092d175f720c735b6 /actionview/test
parentaaf99e3cfc7064e7188fad62386f4e6f897df783 (diff)
parent8feb7c934fd7dea9054b9295b7955bc773f06176 (diff)
downloadrails-61de2e976405b3306ffa20f1b7e903ed21682483.tar.gz
rails-61de2e976405b3306ffa20f1b7e903ed21682483.tar.bz2
rails-61de2e976405b3306ffa20f1b7e903ed21682483.zip
Merge pull request #28753 from st0012/add-render-with-variants-test
Add tests for rendering with variants
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/fixtures/comments/empty.html+grid.erb1
-rw-r--r--actionview/test/fixtures/test/_partial_with_variants.html+grid.erb1
-rw-r--r--actionview/test/template/render_test.rb8
3 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/fixtures/comments/empty.html+grid.erb b/actionview/test/fixtures/comments/empty.html+grid.erb
new file mode 100644
index 0000000000..dc3fa32a81
--- /dev/null
+++ b/actionview/test/fixtures/comments/empty.html+grid.erb
@@ -0,0 +1 @@
+<h1>No Comment</h1>
diff --git a/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb b/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb
new file mode 100644
index 0000000000..225363c8c3
--- /dev/null
+++ b/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb
@@ -0,0 +1 @@
+<h1>Partial with variants</h1>
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index 412948719c..9f9882afee 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -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])