Writing test for CacheHelper

Hi,

I'm working to patch actionpack/lib/action_view/helpers/ cache_helper.rb so that it doesn't throw when ouput_buffer isn't ActionView::OutputBuffer but is still html_safe. In 3-0-stable the function contains the following if:

          if output_buffer.is_a?(ActionView::OutputBuffer)             safe_output_buffer = output_buffer.to_str             fragment = safe_output_buffer.slice!(pos..-1)             self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)           else             fragment = output_buffer.slice!(pos..-1)           end

I have prepared a patch for this [1] which based on [2]. In addition, there is currently a test in caching_test.rb called test_fragment_caching_in_partials. This test would suffice as a template for me but I need to find a way to change the output_buffer in the helper. Any ideas how I could achieve this?

-Lauri

[1]: Fix improper detection and handling of html_safe buffer in CacheHelper by lhahne · Pull Request #2080 · rails/rails · GitHub [2]: rails safebuffer change causes fragment_for failures · Issue #1537 · rails/rails · GitHub