-
-
Save dperrymorrow/2974575 to your computer and use it in GitHub Desktop.
Example Spec File for Ajax Mocking with Jasmine
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
describe("Mocking Ajax Calls", function() { | |
beforeEach(function() { | |
loadFixtures('test.html'); | |
//mocking ajax call with Jasmine Spies | |
var fakeData = "You can put your return data here"; | |
spyOn($, "ajax").andCallFake(function(params) { | |
params.success(fakeData); | |
}); | |
}); | |
it("Should have a Happy Face", function() { | |
mymethod(); | |
expect($('#mydiv')).toHaveText("Happy Face"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment