Problem with testing helper

Hi

I bumped into a problem and tracked it down to this:

Form tag helpers in helpers do not seem to be testable. The helper
does actually work like it should if used in a view.

Example:

This helper:
#############
def form_builder
form_tag “foo” do
text_field_tag(“bar”)
end
end

And this spec:
#############
it “should make a form” do
form_builder.should have_tag(“form”)
end

throws:
#############
undefined method `output_buffer=’ for
#Spec::Rails::Example::HelperExampleGroup::Subclass_1:0x2670ac8

with trace:
#############
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
test_process.rb:471:in method_missing' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/ capture_helper.rb:132:inwith_output_buffer’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/
capture_helper.rb:39:in capture' /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/ form_tag_helper.rb:460:inform_tag_in_block’
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/
form_tag_helper.rb:39:in `form_tag’

rspec and rspec-rails 1.1.11, rails 2.2.2

Any clues?

Thanks
-c

On Tue, Dec 30, 2008 at 9:14 AM, Ivo D.
[email protected] wrote:

#############
form_builder.should have_tag(“form”)
#############

rspec and rspec-rails 1.1.11, rails 2.2.2

Any clues?

Please file a bug report at http://rspec.lighthouseapp.com

Thx,
David

Done:

http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/641-form-tag-helpers-in-helpers

Regards
-c

Op 30-dec-08, om 16:41 heeft David C. het volgende geschreven: