[rspec-users] Problem with testing helper

David Chelimsky dchelimsky at gmail.com
Tue Dec 30 10:41:48 EST 2008


On Tue, Dec 30, 2008 at 9:14 AM, Ivo Dancet <caifara.subscribe at gmail.com> wrote:
> 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?

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

Thx,
David

>
> Thanks
> -c
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list