 #
 # Expects
 #
+# Note: this is better thought of as a mixin; comment further
+#
 class Expects
   
   @expects: (method_name) ->

  
  _find_all_errors = ->
      ( expectation.find_errors() for expectation in _expectations ).join("")
  
  
#
# mocked_method
#
build_mocked_method = (method_name) ->
  (args...) ->
    expectation = AllExpectations.find_expectation(@, method_name, args...)
    throw_unknown_expectation("#{method_name}(#{args})") unless expectation?
    AllExpectations.check_for_duplicate_expectations()
    expectation._called = yes
    throw expectation._throws if expectation._throws?
    expectation._returns

throw_unknown_expectation = (expectation) ->
  throw new Error( "#{expectation} does not match any expectations" )

throw_duplicate_expectation = (expectation) ->
  throw new Error( "#{expectation} is a duplicate expectation" )


#

  _install_mock_method: ->
    object = if is_class(@_object) then @_object.prototype else @_object
    original_method = object[ @_method_name ]
    object[ @_method_name ] = MockedMethod.build_mocked_method(@_method_name)
    if original_method?
      @uninstall_mocked_method = -> object[ @_method_name ] = original_method
    else
