Allow users to set a default spy strategy
This commit is contained in:
@@ -12,7 +12,7 @@ getJasmineRequireObj().Spy = function(j$) {
|
||||
* @constructor
|
||||
* @name Spy
|
||||
*/
|
||||
function Spy(name, originalFn, customStrategies, getPromise) {
|
||||
function Spy(name, originalFn, customStrategies, defaultStrategyFn, getPromise) {
|
||||
var numArgs = typeof originalFn === 'function' ? originalFn.length : 0,
|
||||
wrapper = makeFunc(numArgs, function() {
|
||||
return spy.apply(this, Array.prototype.slice.call(arguments));
|
||||
@@ -127,6 +127,10 @@ getJasmineRequireObj().Spy = function(j$) {
|
||||
};
|
||||
wrapper.calls = callTracker;
|
||||
|
||||
if (defaultStrategyFn) {
|
||||
defaultStrategyFn(wrapper.and);
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user