Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made sure that the possible new output_buffer created by CacheHelper …

…is of the same type as the original
  • Loading branch information...
commit 39a4f67b5d773078ae741803f78fe75f22563fb1 1 parent bc5ccd0
@lhahne lhahne authored
View
2  actionpack/lib/action_view/helpers/cache_helper.rb
@@ -56,7 +56,7 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
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
View
8 actionpack/test/controller/caching_test.rb
@@ -809,8 +809,8 @@ def test_output_buffer
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 @@ def test_safe_buffer
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 }
Please sign in to comment.
Something went wrong with that request. Please try again.