     install_expects_method()
     convenience_mocks = build_convenience_mock_objects()
     run_test_function(test_function, convenience_mocks)
-    verify_all_expectations()
+    AllExpectations.verify_all_expectations()
   finally
     uninstall_expects_method()
     uninstall_all_mocked_methods()
-    forget_all_expectations()
+    AllExpectations.unregister_all_expectations()
 
 install_expects_method = ->
   Object.prototype.expects = expects



#
# all_expectations
#

# TODO: note about there not being that many expectations (i.e. typically fewer than 10?)
all_expectations = []

verify_all_expectations = ->
  errors = find_all_errors()
  throw new Error( errors ) unless errors == ""

find_all_errors = ->
  ( expectation.find_errors() for expectation in all_expectations ).join("")

forget_all_expectations = ->
  all_expectations.length = 0
  
  
#

  delete Object.prototype.expects

# TODO: write comment about uninstalling in reverse
# TODO: move into AllExpectations
uninstall_all_mocked_methods = ->
  expectation.uninstall_mocked_method() for expectation in AllExpectations._expectations by -1

build_convenience_mock_objects = ->
  ( new Object() for i in [1..5] )
