class RSpec::Mocks::ClassNewMethodReference

@private
This method reference implementation handles that specific case.
all args…so the method with the actually used signature is ‘#initialize`.
`def new(*args)` and it simply delegates to `#initialize` and forwards
signature from `#initialize` because `.new`’s signature is a generic
When a class’s ‘.new` method is stubbed, we want to use the method

def self.applies_to?(method_name)

def self.applies_to?(method_name)
  return false unless method_name == :new
  klass = yield
  return false unless klass.respond_to?(:new, true)
  # We only want to apply our special logic to normal `new` methods.
  # Methods that the user has monkeyed with should be left as-is.
  klass.method(:new).owner == ::Class
end

def with_signature

def with_signature
  @object_reference.when_loaded do |klass|
    yield Support::MethodSignature.new(klass.instance_method(:initialize))
  end
end