From bb7ec818009c0fadb227446ad7009440d3d678df Mon Sep 17 00:00:00 2001 From: stephannv <3025661+stephannv@users.noreply.github.com> Date: Tue, 3 Nov 2020 16:52:22 -0300 Subject: [PATCH] Instantiate view with empty template cache --- lib/web_console/template.rb | 2 +- test/web_console/interceptor_test.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/web_console/template.rb b/lib/web_console/template.rb index fde45a92..c98c2368 100644 --- a/lib/web_console/template.rb +++ b/lib/web_console/template.rb @@ -17,7 +17,7 @@ def initialize(env, session) # Render a template (inferred from +template_paths+) as a plain string. def render(template) - view = View.new(ActionView::LookupContext.new(template_paths), instance_values) + view = View.with_empty_template_cache.with_view_paths(template_paths, instance_values) view.render(template: template, layout: false) end end diff --git a/test/web_console/interceptor_test.rb b/test/web_console/interceptor_test.rb index 0bbf4ab4..914ea697 100644 --- a/test/web_console/interceptor_test.rb +++ b/test/web_console/interceptor_test.rb @@ -14,7 +14,8 @@ class InterceptorTest < ActionDispatch::IntegrationTest end def generate_template_error - WebConsole::View.new(ActionView::LookupContext.new([])).render(inline: <<~ERB) + lookup_context = ActionView::LookupContext.new([]) + WebConsole::View.with_empty_template_cache.with_context(lookup_context).render(inline: <<~ERB) <% @ivar = 42 %> <%= nil.raise %>