 #
-# Expectation represents a mocked method that we expect to be called.  
-# It stores the method name, the arguments that we expect to be called 
-# with, a value to return or throw, and whether it has actually been 
+# Expectation represents a mocked method that we expect to be called.
+# It stores the method name, the arguments that we expect to be called
+# with, a value to return or throw, and whether it has actually been
 # called.  For example, the following:
 #
 #   my_mock = new Mock()

    _check_args_usage(@, args...)
    _save_args(@, args)
    @
    
  #
  # my_mock = new Mock()
  # expectation = my_mock.expects("my_method")

  for expectation in _expectations(mock) when expectation.called == false
    errors += "'#{expectation.method_name}(#{expectation._args})' was never called\n"
  errors

_start_new_expectation = (mock, method_name) ->
  _expectations(mock).unshift( new Expectation(method_name) )     # .unshift pushes to front of array

_add_method_to_mock = (mock, method_name) ->
  mock[ method_name ] ?= _build_mocked_method(mock, method_name)

_throw_expects_usage = ->
  throw "you need to supply a method name to .expects(), e.g. my_mock.expects('my_method')"

_throw_reserved_word = (reserved) ->
  throw "you cannot do my_mock.expects('#{reserved}'); '#{reserved}' is a reserved method name"

_throw_duplicate_expectation = (expectation) ->
  throw "#{expectation} is a duplicate expectation"

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