File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
lib/action_controller/metal Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def render(*args) #:nodoc:
4242 def render_to_string ( *)
4343 result = super
4444 if result . respond_to? ( :each )
45- string = ""
45+ string = "" . dup
4646 result . each { |r | string << r }
4747 string
4848 else
Original file line number Diff line number Diff line change @@ -606,6 +606,18 @@ def test_access_to_logger_in_view
606606 end
607607end
608608
609+ class ActionControllerRenderTest < ActionController ::TestCase
610+ class MinimalController < ActionController ::Metal
611+ include AbstractController ::Rendering
612+ include ActionController ::Rendering
613+ end
614+
615+ def test_direct_render_to_string_with_body
616+ mc = MinimalController . new
617+ assert_equal "Hello world!" , mc . render_to_string ( body : [ "Hello world!" ] )
618+ end
619+ end
620+
609621class ActionControllerBaseRenderTest < ActionController ::TestCase
610622 def test_direct_render_to_string
611623 ac = ActionController ::Base . new ( )
You can’t perform that action at this time.
0 commit comments