     fail(messages.NotAnExistingMethod, method_name) if not is_mock_object(object) and not is_class(object) and not does_object_have_method(object, method_name)
     fail(messages.NotAnExistingMethod, method_name) if not is_mock_object(object) and is_class(object) and not does_prototype_have_method(object, method_name)
   
-  _create_expectation = (object, method_name) ->
-    new Expectation(object, method_name)
+  _create_expectation = (object, method_name, all_expectations) ->
+    new Expectation(object, method_name, all_expectations)
 
   _is_reserved_method_name = (expects_method_name, method_name) ->
     method_name == expects_method_name

#
class ExpectsMethod
  
  constructor: (expects_method_name) ->
    _check_constructor_usage(expects_method_name)
    _install_expects_method(expects_method_name)
    _install_uninstall_expects_method(@, expects_method_name)

  # private


  # private

  _install_mock_method = (expectation, all_expectations) ->
    methods = if is_class(expectation._object) then expectation._object.prototype else expectation._object
    original_method = methods[ expectation._method_name ]
    methods[ expectation._method_name ] = _build_mocked_method(expectation._method_name, all_expectations)
    if original_method?
      expectation.uninstall_mocked_method = -> methods[ expectation._method_name ] = original_method
    else
      expectation.uninstall_mocked_method = -> delete methods[ expectation._method_name ]
  
  _build_mocked_method = (method_name, all_expectations) ->
    (args...) ->
      all_expectations.check_for_duplicate_expectations()    # TODO: explain why we call this here
      _invoke( all_expectations.find_expectation(@, method_name, args...) )
      
  _invoke = (expectation) ->
    expectation._called = yes
