Revert removal of compare nesting
Since we want the user to be able to pass a negative comparison function, the extra layer of wrapping is now needed
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
getJasmineRequireObj().toHaveBeenCalled = function(j$) {
|
||||
|
||||
function toHaveBeenCalled() {
|
||||
return function(actual) {
|
||||
var result = {};
|
||||
return {
|
||||
compare: function(actual) {
|
||||
var result = {};
|
||||
|
||||
if (!j$.isSpy(actual)) {
|
||||
throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
|
||||
if (!j$.isSpy(actual)) {
|
||||
throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
|
||||
}
|
||||
|
||||
result.pass = actual.calls.any();
|
||||
|
||||
result.message = result.pass ?
|
||||
"Expected spy " + actual.and.identity() + " not to have been called." :
|
||||
"Expected spy " + actual.and.identity() + " to have been called.";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
|
||||
}
|
||||
|
||||
result.pass = actual.calls.any();
|
||||
|
||||
result.message = result.pass ?
|
||||
"Expected spy " + actual.and.identity() + " not to have been called." :
|
||||
"Expected spy " + actual.and.identity() + " to have been called.";
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user