提交 d24efb79 编写于 作者: R Ryuta Kamizono 提交者: GitHub

Merge pull request #30493 from koic/fix_cant_modify_frozen_string_error_in_ac_rendering

Fix `can't modify frozen String` error in AC::Rendering
......@@ -40,7 +40,7 @@ def render(*args) #:nodoc:
def render_to_string(*)
result = super
if result.respond_to?(:each)
string = ""
string = "".dup
result.each { |r| string << r }
string
else
......
......@@ -606,6 +606,18 @@ def test_access_to_logger_in_view
end
end
class ActionControllerRenderTest < ActionController::TestCase
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
end
def test_direct_render_to_string_with_body
mc = MinimalController.new
assert_equal "Hello world!", mc.render_to_string(body: ["Hello world!"])
end
end
class ActionControllerBaseRenderTest < ActionController::TestCase
def test_direct_render_to_string
ac = ActionController::Base.new()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册