diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-11 13:15:53 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-11 13:15:53 -0800 |
commit | 3b3975b7dbc115636188126eed2a15bebd4e2c98 (patch) | |
tree | 5e8f1b51c0aea5ce2d7cfb0722c273aa41861661 /actionview | |
parent | 38f9e41f2c4b64377ffb036c53873dbfb51546cf (diff) | |
download | rails-3b3975b7dbc115636188126eed2a15bebd4e2c98.tar.gz rails-3b3975b7dbc115636188126eed2a15bebd4e2c98.tar.bz2 rails-3b3975b7dbc115636188126eed2a15bebd4e2c98.zip |
Add a failing test for #35222
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/test/fixtures/test/_first.xml.erb | 1 | ||||
-rw-r--r-- | actionview/test/fixtures/test/_second.html.erb | 1 | ||||
-rw-r--r-- | actionview/test/fixtures/test/_second.xml.erb | 1 | ||||
-rw-r--r-- | actionview/test/fixtures/test/mixing_formats.html.erb | 5 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 6 |
5 files changed, 14 insertions, 0 deletions
diff --git a/actionview/test/fixtures/test/_first.xml.erb b/actionview/test/fixtures/test/_first.xml.erb new file mode 100644 index 0000000000..6dad140cd4 --- /dev/null +++ b/actionview/test/fixtures/test/_first.xml.erb @@ -0,0 +1 @@ +XML diff --git a/actionview/test/fixtures/test/_second.html.erb b/actionview/test/fixtures/test/_second.html.erb new file mode 100644 index 0000000000..f05185c383 --- /dev/null +++ b/actionview/test/fixtures/test/_second.html.erb @@ -0,0 +1 @@ +HTML diff --git a/actionview/test/fixtures/test/_second.xml.erb b/actionview/test/fixtures/test/_second.xml.erb new file mode 100644 index 0000000000..6dad140cd4 --- /dev/null +++ b/actionview/test/fixtures/test/_second.xml.erb @@ -0,0 +1 @@ +XML diff --git a/actionview/test/fixtures/test/mixing_formats.html.erb b/actionview/test/fixtures/test/mixing_formats.html.erb new file mode 100644 index 0000000000..bb4a1d182a --- /dev/null +++ b/actionview/test/fixtures/test/mixing_formats.html.erb @@ -0,0 +1,5 @@ +{"format":"HTML", "children": +[ + "<%= render(partial: "first", formats: :xml).chomp %>", + "<%= render(partial: "second").chomp %>" +]} diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 3f298d81f3..a0b493af9d 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -30,6 +30,12 @@ module RenderTestCases assert_equal ORIGINAL_LOCALES, I18n.available_locales.map(&:to_s).sort end + def test_implicit_format_comes_from_parent_template + rendered_templates = JSON.parse(@controller_view.render(template: "test/mixing_formats")) + assert_equal({ "format" => "HTML", + "children" => ["XML", "HTML"]}, rendered_templates) + end + def test_render_without_options e = assert_raises(ArgumentError) { @view.render() } assert_match(/You invoked render but did not give any of (.+) option\./, e.message) |