class TestUnitMethodOwnerFinder

Public Instance Methods

inspect() click to toggle source
Calls superclass method
# File test-unit-3.3.4/test/util/test-method-owner-finder.rb, line 15
def inspect
  super + " by anonymous parent class"
end
test_find() click to toggle source
# File test-unit-3.3.4/test/util/test-method-owner-finder.rb, line 6
def test_find
  assert_equal(Exception, find(RuntimeError.new, :inspect))
  assert_equal(Exception, find(Exception.new, :inspect))

  anonymous_class = Class.new do
  end
  assert_equal(Kernel, find(anonymous_class.new, :inspect))

  anonymous_parent_class = Class.new do
    def inspect
      super + " by anonymous parent class"
    end
  end
  anonymous_sub_class = Class.new(anonymous_parent_class) do
  end
  assert_equal(anonymous_parent_class, find(anonymous_sub_class.new, :inspect))

  anonymous_module = Module.new do
    def inspect
      super + " by anonymous module"
    end
  end
  anonymous_include_class = Class.new do
    include anonymous_module
  end
  assert_equal(anonymous_module, find(anonymous_include_class.new, :inspect))
end

Private Instance Methods

find(object, method_name) click to toggle source
# File test-unit-3.3.4/test/util/test-method-owner-finder.rb, line 35
def find(object, method_name)
  Test::Unit::Util::MethodOwnerFinder.find(object, method_name)
end