From 7130f9159146776067d334b5043b789860b92761 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 15 Mar 2012 23:39:25 +0100 Subject: Add missing test for #5308 --- actionpack/test/controller/render_test.rb | 13 +++++++++++++ actionpack/test/fixtures/layouts/with_html_partial.html.erb | 1 + actionpack/test/fixtures/test/with_xml_template.html.erb | 1 + 3 files changed, 15 insertions(+) create mode 100644 actionpack/test/fixtures/layouts/with_html_partial.html.erb create mode 100644 actionpack/test/fixtures/test/with_xml_template.html.erb diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index daa2676e22..3cc8a9ddf3 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -560,6 +560,12 @@ class TestController < ActionController::Base render :template => "test/with_partial", :formats => [:text] end + def render_template_within_a_template_with_other_format + render :template => "test/with_xml_template", + :formats => [:html], + :layout => "with_html_partial" + end + def partial_with_counter render :partial => "counter", :locals => { :counter_counter => 5 } end @@ -1289,6 +1295,13 @@ class RenderTest < ActionController::TestCase assert_equal "text/plain", @response.content_type end + def test_render_template_within_a_template_with_other_format + get :render_template_within_a_template_with_other_format + expected = "only html partial

This is grand!

" + assert_equal expected, @response.body.strip + assert_equal "text/html", @response.content_type + end + def test_partial_with_counter get :partial_with_counter assert_equal "5", @response.body diff --git a/actionpack/test/fixtures/layouts/with_html_partial.html.erb b/actionpack/test/fixtures/layouts/with_html_partial.html.erb new file mode 100644 index 0000000000..fd2896aeaa --- /dev/null +++ b/actionpack/test/fixtures/layouts/with_html_partial.html.erb @@ -0,0 +1 @@ +<%= render :partial => "partial_only_html" %><%= yield %> diff --git a/actionpack/test/fixtures/test/with_xml_template.html.erb b/actionpack/test/fixtures/test/with_xml_template.html.erb new file mode 100644 index 0000000000..e54a7cd001 --- /dev/null +++ b/actionpack/test/fixtures/test/with_xml_template.html.erb @@ -0,0 +1 @@ +<%= render :template => "test/greeting", :formats => :xml %> -- cgit v1.2.3