[Finishes #52959947] Warn user about spy conflicts; Refactor spy tests to more reflect responsibilities and removed duplicate tests

This commit is contained in:
Colin O'Byrne and JR Boyens
2013-07-22 16:24:20 -07:00
parent 30aec66ce5
commit 9609aba25f
4 changed files with 109 additions and 205 deletions

View File

@@ -65,13 +65,17 @@ getJasmineRequireObj().base = function(j$) {
return spyStrategy.exec.apply(this, arguments);
};
spy.and = spyStrategy;
spy.calls = callTracker;
for (var prop in originalFn) {
if (prop === 'and' || prop === 'calls') {
throw new Error("Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon");
}
for (prop in originalFn) {
spy[prop] = originalFn[prop];
}
spy.and = spyStrategy;
spy.calls = callTracker;
return spy;
};