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:in
with_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:in
form_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