requirejs and jasmine with nested describe

requirejs and jasmine with nested describe

pI am trying to actually mock my post requests to server . Here is how i
am doing . /p precodedefine(['new'], function (SViewModel) {
describe('xyz', function () { describe('y', function () { var deferred =
$.Deferred(); var postSpy = spyOn($, ajax).andReturn(deferred.promise());
describe('view model with valid inputs', function () { ViewModel = new
SViewModel(); ViewModel.name('abc'); }); describe('register is called',
function () { ViewModel.register(); }); it(it should post, function () {
expect(postSpy).toHaveBeenCalled(); }); it(and : it should redirect to
pendingapproval page, function () { deferred.resolve({ redirect:
/account/pendingapproval, success: true });
expect(redirectSpy).toHaveBeenCalledWith(/account/pendingapproval); });
}); }); }); /code/pre pbut it is saying codeExpected spy ajax to have been
called./code . /p pThanks in advance./p