From 6fccd7b6293dcae383757379c5c3809c6674084e Mon Sep 17 00:00:00 2001 From: Sammy Larbi Date: Thu, 13 Oct 2016 17:53:41 -0500 Subject: Allow any key in Renderer environment hash When rendering arbitrary templates, it is helpful to not overwrite `env` keys with nil if they don't match any found in the `RACK_KEY_TRANSLATION` This allows the developer to set the environment to exactly what is needed for rendering. --- actionpack/test/controller/renderer_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/renderer_test.rb b/actionpack/test/controller/renderer_test.rb index d6f09f2d90..866600b935 100644 --- a/actionpack/test/controller/renderer_test.rb +++ b/actionpack/test/controller/renderer_test.rb @@ -60,6 +60,14 @@ class RendererTest < ActiveSupport::TestCase assert_equal "true", content end + test "rendering with custom env using a key that is not in RACK_KEY_TRANSLATION" do + value = "warden is here" + renderer = ApplicationController.renderer.new warden: value + content = renderer.render inline: "<%= request.env['warden'] %>" + + assert_equal value, content + end + test "rendering with defaults" do renderer = ApplicationController.renderer.new https: true content = renderer.render inline: "<%= request.ssl? %>" -- cgit v1.2.3