require 'spec_helper' class A def foo end include MethodWatcher def foo2 end def foo3 end watch_methods :foo, :foo3 @overridden_methods = [] def self.overridden_methods @overridden_methods end def self.method_overriding method self.overridden_methods << method end end class B < A def foo3 end def foo end @overridden_methods = [] watch_method :foo2 def self.method_overriding method self.overridden_methods << method self.overridden_methods << :test end end class C < B def foo2 end end describe MethodWatcher do it 'should right!' do A.overridden_methods.should == [:foo3, :foo] B.overridden_methods.should == [:foo2, :test] end end