You can write a custom matcher that does this.
Below is some sample code that demonstrates how this might can be done. This example would need to be improved upon to be a good general purpose tool -- if you decide to go this route I suggest taking a look at the source for the toHaveBeenCalledWith matcher and adapt it as necessary because it will capture a lot more of the edge cases than the sample below, which only works when testing for the first argument and continues to process all calls even if it's already found a match; I meant this to be clean and short, not a full robust solution.
beforeEach(function() {
jasmine.getEnv().currentSpec.addMatchers({
toHaveBeenCalledWithExactly: function(expected) {
var self = this, matched = false;
this.actual.calls.forEach(function(call, i) {
if(self.actual.argsForCall[i][0] === expected) {
matched = true;
}
});
return matched;
}
});
});
it('should be able to use object identity when comparing function arguments', function() {
var a = {}, b = {};
var spy = jasmine.createSpy();
spy(a);
expect(spy).toHaveBeenCalledWith(b); // true
expect(spy).toHaveBeenCalledWithExactly(a); // true
expect(spy).toHaveBeenCalledWithExactly(b); // false
});