 
 uninstall_all_mocked_methods = ->
   for expectation in all_expectations     # TODO: do this in reverse
-    object = if typeof expectation._object == 'function' then expectation._object.prototype else expectation._object
-    if expectation._original_method?
-      object[ expectation.method_name ] = expectation._original_method
-    else
-      delete object[ expectation.method_name ]
+    expectation.uninstall_mocked_method()
 
 build_convenience_mock_objects = ->
   ( new Object() for i in [1..5] )

    @_returns = undefined
    @_throws = undefined
    @called = false
    @_original_method = undefined
    _install_mock_method(@, object, method_name)
    all_expectations.push(@)


  expectation._throws = error

_install_mock_method = (expectation, object, method_name) ->
  object = object.prototype if is_class(object)
  original_method = object[ method_name ]
  object[ method_name ] = build_mocked_method(method_name)
  if original_method?
    expectation.uninstall_mocked_method = -> object[ method_name ] = original_method
  else
    expectation.uninstall_mocked_method = -> delete object[ method_name ]

_throw_args_usage = ->
  throw new Error( "you need to supply at least one argument to args(), e.g. my_mock.expects('my_method').args(42)" )
