class Mocha::Mockery

def on_stubbing(object, method)

def on_stubbing(object, method)
  signature_proc = lambda { "#{object.mocha_inspect}.#{method}" }
  check(:stubbing_non_existent_method, 'non-existent method', signature_proc) do
    !(object.stubba_class.__method_exists__?(method, true) || object.respond_to?(method))
  end
  check(:stubbing_non_public_method, 'non-public method', signature_proc) do
    object.stubba_class.__method_exists__?(method, false)
  end
  check(:stubbing_method_on_nil, 'method on nil', signature_proc) { object.nil? }
  check(:stubbing_method_on_non_mock_object, 'method on non-mock object', signature_proc)
end