aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/test/controller/render_test.rb13
-rw-r--r--actionpack/test/fixtures/layouts/with_html_partial.html.erb1
-rw-r--r--actionpack/test/fixtures/test/with_xml_template.html.erb1
3 files changed, 15 insertions, 0 deletions
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<p>This is grand!</p>"
+ 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 %>