Jasmine+sinon.jsでjQuery.ajaxが呼ばれているかテストする

sinon.spyを使うと$.ajaxが呼ばれているかをテストできます。
このときはBackboneのCollectionでfetchが正しいパラメータで呼び出されているかをテストしてみました。

describe("some ajax test", function(){
	beforeEach(function(){
		this.ajaxSpy = sinon.spy($, "ajax");
		this.paramSpy = sinon.spy($, "param");
		this.collection = new MyCollection();
	},
	
	afterEach(function() {
		$.ajax.restore();
		$.param.restore();
	});
	
	it("should make some ajax request using these parameters", function(){
		var start = "2012/6/1";
		var theEnd = "2012/6/31";
		this.collection.someAjaxCall(start, theEnd); 
		expect(this.ajaxSpy).toHaveBeenCalledOnce();
		expect(this.paramSpy).toHaveBeenCalledWith({start: "2012/6/1", theEnd: "2012/6/31"});
	});
});