Question

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?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top