Merge branch 'master' of https://github.com/salticus/jasmine-ajax into salticus-master
This commit is contained in:
commit
27fbe694e5
@ -477,6 +477,9 @@ getJasmineRequireObj().MockAjax = function($ajax) {
|
||||
};
|
||||
|
||||
this.uninstall = function() {
|
||||
if (global.XMLHttpRequest !== mockAjaxFunction) {
|
||||
throw "MockAjax not installed.";
|
||||
}
|
||||
global.XMLHttpRequest = realAjaxFunction;
|
||||
|
||||
this.stubs.reset();
|
||||
|
@ -26,6 +26,16 @@ describe("mockAjax", function() {
|
||||
expect(sequentialInstalls).not.toThrow();
|
||||
});
|
||||
|
||||
it("does throw an error if uninstalled without a current install", function() {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
mockAjax = new window.MockAjax(fakeGlobal);
|
||||
|
||||
expect(function() {
|
||||
mockAjax.uninstall();
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it("does not replace XMLHttpRequest until it is installed", function() {
|
||||
var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'),
|
||||
fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest },
|
||||
|
@ -15,6 +15,9 @@ getJasmineRequireObj().MockAjax = function($ajax) {
|
||||
};
|
||||
|
||||
this.uninstall = function() {
|
||||
if (global.XMLHttpRequest !== mockAjaxFunction) {
|
||||
throw "MockAjax not installed.";
|
||||
}
|
||||
global.XMLHttpRequest = realAjaxFunction;
|
||||
|
||||
this.stubs.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user