vendor/assets/javascripts/sinon.js in sinon-rails-1.7.1.1 vs vendor/assets/javascripts/sinon.js in sinon-rails-1.7.3

- old
+ new

@@ -1,7 +1,7 @@ /** - * Sinon.JS 1.7.1, 2013/05/07 + * Sinon.JS 1.7.3, 2013/06/20 * * @author Christian Johansen (christian@cjohansen.no) * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS * * (The BSD License) @@ -617,10 +617,14 @@ } return true; } + if (aString == "[object Date]") { + return a.valueOf() === b.valueOf(); + } + var prop, aLength = 0, bLength = 0; for (prop in a) { aLength += 1; @@ -775,11 +779,10 @@ try { buster = { format: require("buster-format") }; } catch (e) {} module.exports = sinon; module.exports.spy = require("./sinon/spy"); - module.exports.spyCall = require("./sinon/call"); module.exports.stub = require("./sinon/stub"); module.exports.mock = require("./sinon/mock"); module.exports.collection = require("./sinon/collection"); module.exports.assert = require("./sinon/assert"); module.exports.sandbox = require("./sinon/sandbox"); @@ -1064,20 +1067,17 @@ * * Copyright (c) 2010-2013 Christian Johansen * Copyright (c) 2013 Maximilian Antoni */ -(function (sinon) { - var commonJSModule = typeof module == "object" && typeof require == "function"; - if (!sinon && commonJSModule) { - sinon = require("../sinon"); - } +var commonJSModule = typeof module == "object" && typeof require == "function"; - if (!sinon) { - return; - } +if (!this.sinon && commonJSModule) { + var sinon = require("../sinon"); +} +(function (sinon) { function throwYieldError(proxy, text, args) { var msg = sinon.functionName(proxy) + text; if (args.length) { msg += " Received [" + slice.call(args).join(", ") + "]"; } @@ -1242,21 +1242,15 @@ return proxyCall; }; createSpyCall.toString = callProto.toString; // used by mocks - if (commonJSModule) { - module.exports = createSpyCall; - } else { - sinon.spyCall = createSpyCall; - } + sinon.spyCall = createSpyCall; }(typeof sinon == "object" && sinon || null)); - /** * @depend ../sinon.js - * @depend call.js */ /*jslint eqeqeq: false, onevar: false, plusplus: false*/ /*global module, require, sinon*/ /** * Spy functions @@ -1271,18 +1265,10 @@ var commonJSModule = typeof module == "object" && typeof require == "function"; var push = Array.prototype.push; var slice = Array.prototype.slice; var callId = 0; - if (!sinon && commonJSModule) { - sinon = require("../sinon"); - } - - if (!sinon) { - return; - } - function spy(object, property) { if (!property && typeof object == "function") { return spy.create(object); } @@ -3076,21 +3062,26 @@ this.requestBody = null; this.status = 0; this.statusText = ""; var xhr = this; + var events = ["loadstart", "load", "abort", "loadend"]; - ["loadstart", "load", "abort", "loadend"].forEach(function (eventName) { + function addEventListener(eventName) { xhr.addEventListener(eventName, function (event) { var listener = xhr["on" + eventName]; if (listener && typeof listener == "function") { listener(event); } }); - }); + } + for (var i = events.length - 1; i >= 0; i--) { + addEventListener(events[i]); + } + if (typeof FakeXMLHttpRequest.onCreate == "function") { FakeXMLHttpRequest.onCreate(this); } } @@ -3406,11 +3397,11 @@ this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; this.setResponseBody(body || ""); if (typeof this.onload === "function"){ this.onload(); } - + } }); sinon.extend(FakeXMLHttpRequest, { UNSENT: 0, @@ -4294,6 +4285,6 @@ } else { sinon.assert = assert; } }(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global)); -return sinon;}.call(typeof window != 'undefined' && window || {})); +return sinon;}.call(typeof window != 'undefined' && window || {})); \ No newline at end of file