Skip to content

Commit

Permalink
Merge pull request #304 from stephannv/fix/instantiate_view_with_empt…
Browse files Browse the repository at this point in the history
…y_template_cache

Instantiate view with empty template cache
  • Loading branch information
gsamokovarov authored Nov 4, 2020
2 parents 788eeba + bb7ec81 commit 5451b57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/web_console/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/web_console/interceptor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</h1
Expand Down

0 comments on commit 5451b57

Please sign in to comment.