# File lib/rspec/mocks/method_double.rb, line 99 def original_method_from_ancestry original_method_from_ancestor(object_singleton_class.ancestors) rescue NameError raise unless @object.respond_to?(:superclass) # Example: a singleton method defined on @object's superclass. # # Note: we have to give precedence to instance methods # defined on @object's class, because in a case like: # # `klass.should_receive(:new).and_call_original` # # ...we want `Class#new` bound to `klass` (which will return # an instance of `klass`), not `klass.superclass.new` (which # would return an instance of `klass.superclass`). original_method_from_superclass end