Merge pull request #5101 from ckdake/ckdake_actionview_handler_reset

Reset memoized hash keys when new ActionView::Template handler is registered
This commit is contained in:
José Valim
2012-02-20 11:48:14 -08:00
2 changed files with 7 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ module ActionView #:nodoc:
# return the rendered template as a string.
def register_template_handler(extension, klass)
@@template_handlers[extension.to_sym] = klass
@@template_extensions = nil
end
def template_handler_extensions

View File

@@ -329,6 +329,12 @@ module RenderTestCases
ActionView::Template.register_template_handler :foo, CustomHandler
assert_equal 'source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
end
def test_render_knows_about_types_registered_when_extensions_are_checked_earlier_in_initialization
ActionView::Template::Handlers.extensions
ActionView::Template.register_template_handler :foo, CustomHandler
assert ActionView::Template::Handlers.extensions.include?(:foo)
end
def test_render_ignores_templates_with_malformed_template_handlers
ActiveSupport::Deprecation.silence do