diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-11 15:24:55 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-11 17:55:53 -0800 |
commit | 9439a18bf76b3b7c759340abf0d7a5fb17fc82f7 (patch) | |
tree | 3e784624ac93c5bd1c87bf366788af36689e7c28 /actionview | |
parent | 3b3975b7dbc115636188126eed2a15bebd4e2c98 (diff) | |
download | rails-9439a18bf76b3b7c759340abf0d7a5fb17fc82f7.tar.gz rails-9439a18bf76b3b7c759340abf0d7a5fb17fc82f7.tar.bz2 rails-9439a18bf76b3b7c759340abf0d7a5fb17fc82f7.zip |
Adding another failing test case
Diffstat (limited to 'actionview')
11 files changed, 39 insertions, 6 deletions
diff --git a/actionview/test/fixtures/test/_first.html.erb b/actionview/test/fixtures/test/_first.html.erb new file mode 100644 index 0000000000..2e2c825acb --- /dev/null +++ b/actionview/test/fixtures/test/_first.html.erb @@ -0,0 +1 @@ +"HTML" diff --git a/actionview/test/fixtures/test/_first.xml.erb b/actionview/test/fixtures/test/_first.xml.erb index 6dad140cd4..9cf4f4ec85 100644 --- a/actionview/test/fixtures/test/_first.xml.erb +++ b/actionview/test/fixtures/test/_first.xml.erb @@ -1 +1 @@ -XML +"XML" diff --git a/actionview/test/fixtures/test/_first_layer.html.erb b/actionview/test/fixtures/test/_first_layer.html.erb new file mode 100644 index 0000000000..9f60d20e24 --- /dev/null +++ b/actionview/test/fixtures/test/_first_layer.html.erb @@ -0,0 +1,6 @@ +{"format":"HTML", "children": +[ + <%= render(partial: "first").chomp.html_safe %>, +]} + + diff --git a/actionview/test/fixtures/test/_first_layer.xml.erb b/actionview/test/fixtures/test/_first_layer.xml.erb new file mode 100644 index 0000000000..b8581bbbfc --- /dev/null +++ b/actionview/test/fixtures/test/_first_layer.xml.erb @@ -0,0 +1,4 @@ +{"format":"XML", "children": +[ + <%= render(partial: "first").chomp.html_safe %> +]} diff --git a/actionview/test/fixtures/test/_second.html.erb b/actionview/test/fixtures/test/_second.html.erb index f05185c383..2e2c825acb 100644 --- a/actionview/test/fixtures/test/_second.html.erb +++ b/actionview/test/fixtures/test/_second.html.erb @@ -1 +1 @@ -HTML +"HTML" diff --git a/actionview/test/fixtures/test/_second.xml.erb b/actionview/test/fixtures/test/_second.xml.erb index 6dad140cd4..9cf4f4ec85 100644 --- a/actionview/test/fixtures/test/_second.xml.erb +++ b/actionview/test/fixtures/test/_second.xml.erb @@ -1 +1 @@ -XML +"XML" diff --git a/actionview/test/fixtures/test/_second_layer.html.erb b/actionview/test/fixtures/test/_second_layer.html.erb new file mode 100644 index 0000000000..307706abd2 --- /dev/null +++ b/actionview/test/fixtures/test/_second_layer.html.erb @@ -0,0 +1,4 @@ +{"format":"HTML", "children": +[ + <%= render(partial: "first").chomp.html_safe %> +]} diff --git a/actionview/test/fixtures/test/_second_layer.xml.erb b/actionview/test/fixtures/test/_second_layer.xml.erb new file mode 100644 index 0000000000..b8581bbbfc --- /dev/null +++ b/actionview/test/fixtures/test/_second_layer.xml.erb @@ -0,0 +1,4 @@ +{"format":"XML", "children": +[ + <%= render(partial: "first").chomp.html_safe %> +]} diff --git a/actionview/test/fixtures/test/mixing_formats.html.erb b/actionview/test/fixtures/test/mixing_formats.html.erb index bb4a1d182a..c65cdd7dd4 100644 --- a/actionview/test/fixtures/test/mixing_formats.html.erb +++ b/actionview/test/fixtures/test/mixing_formats.html.erb @@ -1,5 +1,5 @@ {"format":"HTML", "children": [ - "<%= render(partial: "first", formats: :xml).chomp %>", - "<%= render(partial: "second").chomp %>" + <%= render(partial: "first", formats: :xml).chomp.html_safe %>, + <%= render(partial: "second").chomp.html_safe %> ]} diff --git a/actionview/test/fixtures/test/mixing_formats_deep.html.erb b/actionview/test/fixtures/test/mixing_formats_deep.html.erb new file mode 100644 index 0000000000..e328887eeb --- /dev/null +++ b/actionview/test/fixtures/test/mixing_formats_deep.html.erb @@ -0,0 +1,5 @@ +{"format":"HTML", "children": +[ + <%= render(partial: "first_layer", formats: :xml).chomp.html_safe %>, + <%= render(partial: "second_layer").chomp.html_safe %> +]} diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index a0b493af9d..e36babfd25 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -33,7 +33,16 @@ module RenderTestCases 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) + "children" => ["XML", "HTML"] }, rendered_templates) + end + + def test_implicit_format_comes_from_parent_template_cascading + rendered_templates = JSON.parse(@controller_view.render(template: "test/mixing_formats_deep")) + assert_equal({ "format" => "HTML", + "children" => [ + { "format" => "XML", "children" => ["XML"] }, + { "format" => "HTML", "children" => ["HTML"] }, + ] }, rendered_templates) end def test_render_without_options |