class TestMinitestUnitInherited

Public Instance Methods

inherited_with_hacks(_klass) click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 168
def inherited_with_hacks _klass
  throw :inherited_hook
end
test_inherited_hook_plays_nice_with_others() click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 190
def test_inherited_hook_plays_nice_with_others
  with_overridden_include do
    assert_throws :inherited_hook do
      Class.new FakeNamedTest
    end
  end
end
with_overridden_include() { || ... } click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 166
def with_overridden_include
  Class.class_eval do
    def inherited_with_hacks _klass
      throw :inherited_hook
    end

    alias inherited_without_hacks inherited
    alias inherited               inherited_with_hacks
    alias IGNORE_ME!              inherited # 1.8 bug. god I love venture bros
  end

  yield
ensure
  Class.class_eval do
    alias inherited inherited_without_hacks

    undef_method :inherited_with_hacks
    undef_method :inherited_without_hacks
  end

  refute_respond_to Class, :inherited_with_hacks
  refute_respond_to Class, :inherited_without_hacks
end