Skip to content

Commit 74a9929

Browse files
authored
Merge pull request rails#45679 from Shopify/action-view-no-safe-buffer
Always use an actual Action View buffer to render templates
2 parents b8964e5 + 532e39a commit 74a9929

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

actionview/lib/action_view/test_case.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ def setup_with_controller
110110
@controller = controller_class.new
111111
@request = @controller.request
112112
@view_flow = ActionView::OutputFlow.new
113-
# empty string ensures buffer has UTF-8 encoding as
114-
# new without arguments returns ASCII-8BIT encoded buffer like String#new
115-
@output_buffer = ActiveSupport::SafeBuffer.new ""
113+
@output_buffer = ActionView::OutputBuffer.new
116114
@rendered = +""
117115

118116
test_case_instance = self
@@ -181,7 +179,7 @@ def _test_case
181179
private
182180
# Need to experiment if this priority is the best one: rendered => output_buffer
183181
def document_root_element
184-
Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer : @rendered).root
182+
Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer.to_str : @rendered).root
185183
end
186184

187185
module Locals

0 commit comments

Comments
 (0)