def proxy object, method_name
      # do not proxify doubles
      return if object.respond_to?(:__ms__double_instance)

      # do not proxify stubs
      return if (x = @__ms__stubs__originals) && (x = x[object]) && x[method_name]

      proxies = (@__ms__proxies[object] ||= [])
      return if proxies.include?(method_name)
      proxies << method_name

      # method exists and it is a singleton.
      # `nil?` method can be overridden only through a singleton
      if method_name == :nil? || object.singleton_methods.include?(method_name)
        return __ms__mocks__define_singleton_proxy(object, method_name)
      end

      # method exists and it is not a singleton, define a regular proxy
      if visibility = MiniSpec::Utils.method_visibility(object, method_name)
        return __ms__mocks__define_regular_proxy(object, method_name, visibility)
      end

      raise(NoMethodError, '%s does not respond to %s. Can not proxify an un-existing method.' % [
        object.inspect, method_name.inspect
      ])
    end
def proxy object, method_name
      # do not proxify doubles
      return if object.respond_to?(:__ms__double_instance)

      # do not proxify stubs
      return if (x = @__ms__stubs__originals) && (x = x[object]) && x[method_name]

      proxies = (@__ms__proxies[object] ||= [])
      return if proxies.include?(method_name)
      proxies << method_name

      # method exists and it is a singleton.
      # `nil?` method can be overridden only through a singleton
      if method_name == :nil? || object.singleton_methods.include?(method_name)
        return __ms__mocks__define_singleton_proxy(object, method_name)
      end

      # method exists and it is not a singleton, define a regular proxy
      if visibility = MiniSpec::Utils.method_visibility(object, method_name)
        return __ms__mocks__define_regular_proxy(object, method_name, visibility)
      end

      raise(NoMethodError, '%s does not respond to %s. Can not proxify an un-existing method.' % [
        object.inspect, method_name.inspect
      ])
    end
overriding given method of given object with a proxy
 so MiniSpec can later check whether given method was called.

 if given method does not exists a NoMethodError raised

 @note  doubles and stubs will be skipped as they are already proxified

 @example
   proxy(obj, :a)
   assert(obj).received(:a)  # checking whether obj received :a message

 @param object
 @param method_name