views:

132

answers:

1

I am creating a Rails plugin and it is dynamically adding a method to a Helper. I just want to ensure that the method is added. How can I see if the Helper responds to the method name?

+5  A: 

Try this:

def test_that_foo_helper_defines_bar
  o = Object.new
  assert !o.respond_to? :bar
  o.extend FooHelper
  assert o.respond_to? :bar
end
James A. Rosen
Fantastic! Thanks for the help.
Sixty4Bit