Rather than replacing the `$.ajax` function with a fake, it's much more accurate and more flexible to use [`sinon. useFakeXMLHttpRequest`](http://sinonjs.org/docs/#server).