If you take a look at the code, you will see that the cleanup does not affect already "running" calls. It just makes sure that any subsequent $.ajax()
will call jQuery's original method and that other internal state (but again, not affecting already pending "requests") is cleaned.
This may help to ensure that the $.ajax()
call under test test is only sent once (if more are sent they will fail, moreover the start()
method will be called again, reporting the error to Qunit).
It could also be this way just to keep code clean (less stuff in the callback handlers).