mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Restore lookup formats to the previous value after searching for the failing view
This commit is contained in:
@@ -164,10 +164,12 @@ module ActionView
|
||||
pieces = @virtual_path.split("/")
|
||||
name = pieces.pop
|
||||
partial = !!name.sub!(/^_/, "")
|
||||
lookup.formats = @formats
|
||||
previous_formats, lookup.formats = lookup.formats, @formats
|
||||
lookup.disable_cache do
|
||||
lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
|
||||
end
|
||||
ensure
|
||||
lookup.formats = previous_formats
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
||||
@@ -52,10 +52,11 @@ module RenderTestCases
|
||||
end
|
||||
|
||||
def test_render_template_with_a_missing_partial_of_another_format
|
||||
@view.lookup_context.freeze_formats([:html])
|
||||
assert_raise ActionView::Template::Error, "Missing partial /missing with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder]}" do
|
||||
@view.lookup_context.freeze_formats([:html])
|
||||
@view.render(:template => "with_format", :formats => [:json])
|
||||
end
|
||||
assert_equal [:html], @view.lookup_context.formats
|
||||
end
|
||||
|
||||
def test_render_file_with_locale
|
||||
|
||||
Reference in New Issue
Block a user