lib/stub.js
function calledWith() {
  var calledWithCount = 0;
  var args = [];
  var argsLength = arguments.length;
  for (var i = 0; i < argsLength; i++) {
    args[i] = arguments[i];
  }
  var callsLength = this._calls.length;
  CALLS: for (var i = 0; i < callsLength; i++) {
    var match = false;
    var called = this._calls[i];
    var calledLength = called.length;
    if (argsLength === 0 && calledLength === 0) {
      match = true;
    } else {
      ARGS: for (var a = 0; a < argsLength; a++) {
        match = matchArgs(args[a],called[a]);
        if (!match) {
          break ARGS;
        }
      }
    }
    if (match) {
      calledWithCount++;
    }
  }
  return calledWithCount;
}
function calledWith() {
  var calledWithCount = 0;
  var args = [];
  var argsLength = arguments.length;
  for (var i = 0; i < argsLength; i++) {
    args[i] = arguments[i];
  }
  var callsLength = this._calls.length;
  CALLS: for (var i = 0; i < callsLength; i++) {
    var match = false;
    var called = this._calls[i];
    var calledLength = called.length;
    if (argsLength === 0 && calledLength === 0) {
      match = true;
    } else {
      ARGS: for (var a = 0; a < argsLength; a++) {
        match = matchArgs(args[a],called[a]);
        if (!match) {
          break ARGS;
        }
      }
    }
    if (match) {
      calledWithCount++;
    }
  }
  return calledWithCount;
}
function calledWith ( ) { var calledWithCount = 0 ; var args = [ ] ; var argsLength = arguments . length ; for ( var i = 0 ; i < argsLength ; i ++ ) { args [ i ] = arguments [ i ] ; } var callsLength = this . _calls . length ; CALLS : for ( var i = 0 ; i < callsLength ; i ++ ) { var match = false ; var called = this . _calls [ i ] ; var calledLength = called . length ; if ( argsLength === 0 && calledLength === 0 ) { match = true ; } else { ARGS : for ( var a = 0 ; a < argsLength ; a ++ ) { match = matchArgs ( args [ a ] , called [ a ] ) ; if ( ! match ) { break ARGS ; } } } if ( match ) { calledWithCount ++ ; } } return calledWithCount ; }
Count how many times stub have been called with passed arguments.
Count how many times stub have been called with passed arguments .