Sha256: 508b7b9aa36c1482bbfaaca8ca79172040671db8624cc0a09876a9faf31c7786
Contents?: true
Size: 1.11 KB
Versions: 39
Compression:
Stored size: 1.11 KB
Contents
getJasmineRequireObj().MockAjax = function($ajax) { function MockAjax(global) { var requestTracker = new $ajax.RequestTracker(), stubTracker = new $ajax.StubTracker(), paramParser = new $ajax.ParamParser(), realAjaxFunction = global.XMLHttpRequest, mockAjaxFunction = $ajax.fakeRequest(global, requestTracker, stubTracker, paramParser); this.install = function() { global.XMLHttpRequest = mockAjaxFunction; }; this.uninstall = function() { global.XMLHttpRequest = realAjaxFunction; this.stubs.reset(); this.requests.reset(); paramParser.reset(); }; this.stubRequest = function(url, data, method) { var stub = new $ajax.RequestStub(url, data, method); stubTracker.addStub(stub); return stub; }; this.withMock = function(closure) { this.install(); try { closure(); } finally { this.uninstall(); } }; this.addCustomParamParser = function(parser) { paramParser.add(parser); }; this.requests = requestTracker; this.stubs = stubTracker; } return MockAjax; };
Version data entries
39 entries across 39 versions & 1 rubygems