mirror of
https://github.com/github/rails.git
synced 2026-01-15 01:28:17 -05:00
made sure that the possible new output_buffer created by CacheHelper is of the same type as the original
This commit is contained in:
@@ -56,7 +56,7 @@ module ActionView
|
||||
if output_buffer.html_safe?
|
||||
safe_output_buffer = output_buffer.to_str
|
||||
fragment = safe_output_buffer.slice!(pos..-1)
|
||||
self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)
|
||||
self.output_buffer = output_buffer.class.new(safe_output_buffer)
|
||||
else
|
||||
fragment = output_buffer.slice!(pos..-1)
|
||||
end
|
||||
|
||||
@@ -809,8 +809,8 @@ class CacheHelperOutputBufferTest < ActionController::TestCase
|
||||
cache_helper.extend(ActionView::Helpers::CacheHelper)
|
||||
cache_helper.expects(:controller).returns(controller).at_least(0)
|
||||
cache_helper.expects(:output_buffer).returns(output_buffer).at_least(0)
|
||||
# if the output_buffer is changed, the new one should be html_safe
|
||||
cache_helper.expects(:output_buffer=).with(responds_with(:html_safe?, true)).returns(true).at_least(0)
|
||||
# if the output_buffer is changed, the new one should be html_safe and of the same type
|
||||
cache_helper.expects(:output_buffer=).with(responds_with(:html_safe?, true)).with(instance_of(output_buffer.class)).at_least(0)
|
||||
|
||||
assert_nothing_raised do
|
||||
cache_helper.send :fragment_for, 'Test fragment name', 'Test fragment', &Proc.new{ nil }
|
||||
@@ -825,8 +825,8 @@ class CacheHelperOutputBufferTest < ActionController::TestCase
|
||||
cache_helper.extend(ActionView::Helpers::CacheHelper)
|
||||
cache_helper.expects(:controller).returns(controller).at_least(0)
|
||||
cache_helper.expects(:output_buffer).returns(output_buffer).at_least(0)
|
||||
# if the output_buffer is changed, the new one should be html_safe
|
||||
cache_helper.expects(:output_buffer=).with(responds_with(:html_safe?, true)).returns(true).at_least(0)
|
||||
# if the output_buffer is changed, the new one should be html_safe and of the same type
|
||||
cache_helper.expects(:output_buffer=).with(responds_with(:html_safe?, true)).with(instance_of(output_buffer.class)).at_least(0)
|
||||
|
||||
assert_nothing_raised do
|
||||
cache_helper.send :fragment_for, 'Test fragment name', 'Test fragment', &Proc.new{ nil }
|
||||
|
||||
Reference in New Issue
Block a user