(api, method, matchAny, actual, notCalled)
| 1083 | sinon.extend(spy, (function () { |
| 1084 | |
| 1085 | function delegateToCalls(api, method, matchAny, actual, notCalled) { |
| 1086 | api[method] = function () { |
| 1087 | if (!this.called) { |
| 1088 | if (notCalled) { |
| 1089 | return notCalled.apply(this, arguments); |
| 1090 | } |
| 1091 | return false; |
| 1092 | } |
| 1093 | |
| 1094 | var currentCall; |
| 1095 | var matches = 0; |
| 1096 | |
| 1097 | for (var i = 0, l = this.callCount; i < l; i += 1) { |
| 1098 | currentCall = this.getCall(i); |
| 1099 | |
| 1100 | if (currentCall[actual || method].apply(currentCall, arguments)) { |
| 1101 | matches += 1; |
| 1102 | |
| 1103 | if (matchAny) { |
| 1104 | return true; |
| 1105 | } |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | return matches === this.callCount; |
| 1110 | }; |
| 1111 | } |
| 1112 | |
| 1113 | function matchingFake(fakes, args, strict) { |
| 1114 | if (!fakes) { |
no outgoing calls
no test coverage detected
searching dependent graphs…