   
   _expectations = []
   
+  # TODO: rename to _gather_all_errors?
   _find_all_errors = ->
       ( expectation.find_errors() for expectation in _expectations ).join("")
 

  @check_for_duplicate_expectations: ->
    # TODO: use each with index and slice to avoid last element
    return if _expectations.length < 2
    for outer in [0.._expectations.length-2]
      for inner in [outer+1.._expectations.length-1]
        if _expectations[outer].equals( _expectations[inner] )
          _throw_duplicate_expectation("#{_expectations[outer]._method_name}(#{_expectations[outer]._args})")


  @register_expectation: (expectation) ->
    _expectations.push(expectation)
    
  @find_expectation_that_matches: (object, method_name, args...) ->
    for expectation in _expectations when expectation.matches(object, method_name, args...)
      return expectation
    undefined
