Describe 'a spec for a helper that takes a block' i.should need_to_do_this?

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs