Watson1978
3/23/2011 - 1:40 AM

test_respond_to_missing.rb

require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class Foo
  def respond_to_missing?(method, priv= false)
    #puts "respond_to_missing? : " + method.inspect
    method
  end
end

obj = Foo.new
assert_equal(true, obj.respond_to?(:bar))
assert_match(/Foo#bar/, obj.public_method(:bar).inspect)

puts :ok