mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix #5238, rendered_format is not set when template is not rendered
This commit is contained in:
committed by
Santiago Pastorino
parent
bbe7dac223
commit
1a71e84ad8
@@ -273,6 +273,8 @@ module ActionView
|
||||
@block = block
|
||||
@details = extract_details(options)
|
||||
|
||||
@lookup_context.rendered_format ||= formats.first
|
||||
|
||||
if String === partial
|
||||
@object = options[:object]
|
||||
@path = partial
|
||||
|
||||
@@ -1241,22 +1241,26 @@ class RenderTest < ActionController::TestCase
|
||||
def test_partial_only
|
||||
get :partial_only
|
||||
assert_equal "only partial", @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
|
||||
def test_should_render_html_formatted_partial
|
||||
get :partial
|
||||
assert_equal 'partial html', @response.body
|
||||
assert_equal "partial html", @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
|
||||
def test_should_render_html_partial_with_formats
|
||||
get :partial_formats_html
|
||||
assert_equal 'partial html', @response.body
|
||||
assert_equal "partial html", @response.body
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
|
||||
def test_render_to_string_partial
|
||||
get :render_to_string_with_partial
|
||||
assert_equal "only partial", assigns(:partial_only)
|
||||
assert_equal "Hello: david", assigns(:partial_with_locals)
|
||||
assert_equal "text/html", @response.content_type
|
||||
end
|
||||
|
||||
def test_partial_with_counter
|
||||
|
||||
Reference in New Issue
Block a user