diff options
Diffstat (limited to 'javascript/spec/specHelper.js')
-rw-r--r-- | javascript/spec/specHelper.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/javascript/spec/specHelper.js b/javascript/spec/specHelper.js index 5f8071d..747fa9d 100644 --- a/javascript/spec/specHelper.js +++ b/javascript/spec/specHelper.js @@ -12,11 +12,20 @@ var specHelper = (function() { header = { "Content-Type": "application/json;charset=utf-8" }; body = JSON.stringify(object); request.respond(200, header, body); - } + } + + function setupFakeXHR() { + this.xhr = sinon.useFakeXMLHttpRequest(); + var requests = this.requests = []; + this.xhr.onCreate = function (xhr) { + requests.push(xhr); + }; + } return { respondJSON: respondJSON, - respondXML: respondXML + respondXML: respondXML, + setupFakeXHR: setupFakeXHR } })(); |