Pass through custom equality testers in toHaveBeenCalledWith [fixes #536]

This commit is contained in:
Sheel Choksi
2014-03-26 22:19:03 -07:00
parent e53b487017
commit 00c8e37257
3 changed files with 18 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
function toHaveBeenCalledWith(util) {
function toHaveBeenCalledWith(util, customEqualityTesters) {
return {
compare: function() {
var args = Array.prototype.slice.call(arguments, 0),
@@ -17,7 +17,7 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
return result;
}
if (util.contains(actual.calls.allArgs(), expectedArgs)) {
if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) {
result.pass = true;
result.message = function() { return 'Expected spy ' + actual.and.identity() + ' not to have been called with ' + j$.pp(expectedArgs) + ' but it was.'; };
} else {