Forum: RSpec describe 'a spec for a helper that takes a block' i.should need_to_do_this?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Higgaion (Guest)
on 2009-04-27 22:48
(Received via mailing list)
i have a helper like this:

def swf_upload_tag( upload_url, options = {},  &block)
    # irelavant stuff removed
    button_text = capture(&block)
    unless button_text.blank?
      options.merge!( :button_text => button_text )
    # irelavant stuff removed
    concat( content_tag( :div, '',  :id => opts
[:button_placeholder_id] ) <<
      update_page_tag do |page| "SWFUpload.init", recursive_options_for_javascript
      end, block.binding

to spec it i had to do this in my before block:

      before do
        helper.output_buffer = '' # wouldn't empty string make a good
        helper.instance_variable_set(:@template, helper ) # i probably
shouldn't have to do this.

otherwise capture_helper.rb and prototype_helper.rb would raise.
these things seem to be reasonable defaults: the output_buffer a blank
screen, and @template set to the context of the helper...

what do you all think? is there some reason *not* to always set these?
This topic is locked and can not be replied to.