class RSpec::Mocks::MethodDouble

def usable_rspec_prepended_module

def usable_rspec_prepended_module
  @proxy.prepended_modules_of_singleton_class.each do |mod|
    # If we have one of our modules prepended before one of the user's
    # modules that defines the method, use that, since our module's
    # definition will take precedence.
    return mod if RSpecPrependedModule === mod
    # If we hit a user module with the method defined first,
    # we must create a new prepend module, even if one exists later,
    # because ours will only take precedence if it comes first.
    return new_rspec_prepended_module if mod.method_defined?(method_name)
  end
  nil
end