aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorSammy Larbi <sam@codeodor.com>2016-10-13 17:53:41 -0500
committerSammy Larbi <sam@codeodor.com>2016-10-15 07:03:33 -0500
commit6fccd7b6293dcae383757379c5c3809c6674084e (patch)
treebd2049dc156244eb1aaa70fffb50ea5ca0ba74f4 /actionpack/test/controller
parente10e3c7da215ef848db7592068993f14aac00fa6 (diff)
downloadrails-6fccd7b6293dcae383757379c5c3809c6674084e.tar.gz
rails-6fccd7b6293dcae383757379c5c3809c6674084e.tar.bz2
rails-6fccd7b6293dcae383757379c5c3809c6674084e.zip
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.
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/renderer_test.rb8
1 files changed, 8 insertions, 0 deletions
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? %>"