Created
May 29, 2013 14:13
-
-
Save johanlunds/5670559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("should receive a successful response", function() { | |
spyOn($, "ajax").andCallFake(function(e) { | |
e.success({}); | |
}); | |
var callbacks = { | |
checkForInformation : jasmine.createSpy(), | |
displayCorrectMessagesAfterAjaxCallsComplete : jasmine.createSpy(), | |
retryRequest : jasmine.createSpy() | |
}; | |
sendRequest(callbacks, configuration); | |
expect(callbacks. checkForInformation).toHaveBeenCalled(); //Verifies this was called | |
expect(callbacks. retryRequest).toHaveBeenCalled(); //Verifies this was called | |
}); | |
it("should call Ajax error", function() { | |
spyOn($, "ajax").andCallFake(function(e) { | |
e.error({}); | |
}); | |
var callbacks = { | |
displayCorrectMessagesAfterAjaxCallsComplete : jasmine.createSpy() | |
}; | |
sendRequest(callbacks, configuration); | |
expect(callbacks.displayCorrectMessagesAfterAjaxCallsComplete).toHaveBeenCalled(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment