I\'m testing a function that takes a date as an optional argument. I want to assert that a new Date object is created if the function is called without the argument.
For the users who are using Edge version of Jasmine:
it('Should spy on Date', function() {
var oldDate = Date;
// and.callFake
spyOn(window, 'Date').and.callFake(function() {
return new oldDate();
});
var d = new Date().toISOString;
expect(window.Date).toHaveBeenCalled();
});