sinon-rails 1.3.2.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +9 -5
- data/lib/sinon-rails.rb +1 -1
- data/lib/sinon-rails/version.rb +1 -1
- data/sinon-rails.gemspec +0 -1
- data/vendor/assets/javascripts/sinon.js +621 -92
- metadata +3 -3
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# Sinon
|
1
|
+
# Sinon.js for Rails
|
2
2
|
|
3
|
-
|
3
|
+
sinon.js via asset pipeline
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -12,16 +12,20 @@ And then execute:
|
|
12
12
|
|
13
13
|
$ bundle
|
14
14
|
|
15
|
-
|
15
|
+
Add this line to your test manifest file:
|
16
16
|
|
17
|
-
|
17
|
+
//=require sinon
|
18
|
+
|
19
|
+
Or directly include at `/assets/sinon.js`
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
Read about sinon.js [here](http://sinonjs.org/).
|
22
24
|
|
23
25
|
## Contributing
|
24
26
|
|
27
|
+
sinon-rails maintained by [Travis Jeffery](http://github.com/travisjeffery)
|
28
|
+
|
25
29
|
1. Fork it
|
26
30
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
31
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
data/lib/sinon-rails.rb
CHANGED
data/lib/sinon-rails/version.rb
CHANGED
data/sinon-rails.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
/**
|
2
|
-
* Sinon.JS 1.
|
2
|
+
* Sinon.JS 1.4.2, 2012/07/11
|
3
3
|
*
|
4
4
|
* @author Christian Johansen (christian@cjohansen.no)
|
5
|
+
* @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
|
5
6
|
*
|
6
7
|
* (The BSD License)
|
7
8
|
*
|
8
|
-
* Copyright (c) 2010-
|
9
|
+
* Copyright (c) 2010-2012, Christian Johansen, christian@cjohansen.no
|
9
10
|
* All rights reserved.
|
10
11
|
*
|
11
12
|
* Redistribution and use in source and binary forms, with or without modification,
|
@@ -34,94 +35,232 @@
|
|
34
35
|
|
35
36
|
"use strict";
|
36
37
|
var sinon = (function () {
|
37
|
-
var buster = (function (
|
38
|
-
function
|
39
|
-
if (!target) {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
|
43
|
-
for (var i = 1, l = arguments.length, prop; i < l; ++i) {
|
44
|
-
for (prop in arguments[i]) {
|
45
|
-
target[prop] = arguments[i][prop];
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
return target;
|
50
|
-
}
|
51
|
-
|
38
|
+
var buster = (function (setTimeout, B) {
|
39
|
+
var isNode = typeof require == "function" && typeof module == "object";
|
52
40
|
var div = typeof document != "undefined" && document.createElement("div");
|
41
|
+
var F = function () {};
|
53
42
|
|
54
|
-
|
55
|
-
bind: function (obj, methOrProp) {
|
43
|
+
var buster = {
|
44
|
+
bind: function bind(obj, methOrProp) {
|
56
45
|
var method = typeof methOrProp == "string" ? obj[methOrProp] : methOrProp;
|
57
46
|
var args = Array.prototype.slice.call(arguments, 2);
|
58
|
-
|
59
47
|
return function () {
|
60
48
|
var allArgs = args.concat(Array.prototype.slice.call(arguments));
|
61
49
|
return method.apply(obj, allArgs);
|
62
50
|
};
|
63
51
|
},
|
64
52
|
|
65
|
-
|
66
|
-
|
53
|
+
partial: function partial(fn) {
|
54
|
+
var args = [].slice.call(arguments, 1);
|
55
|
+
return function () {
|
56
|
+
return fn.apply(this, args.concat([].slice.call(arguments)));
|
57
|
+
};
|
58
|
+
},
|
67
59
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}()),
|
60
|
+
create: function create(object) {
|
61
|
+
F.prototype = object;
|
62
|
+
return new F();
|
63
|
+
},
|
73
64
|
|
74
|
-
extend: extend
|
65
|
+
extend: function extend(target) {
|
66
|
+
if (!target) { return; }
|
67
|
+
for (var i = 1, l = arguments.length, prop; i < l; ++i) {
|
68
|
+
for (prop in arguments[i]) {
|
69
|
+
target[prop] = arguments[i][prop];
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return target;
|
73
|
+
},
|
75
74
|
|
76
|
-
nextTick: function (callback) {
|
75
|
+
nextTick: function nextTick(callback) {
|
77
76
|
if (typeof process != "undefined" && process.nextTick) {
|
78
77
|
return process.nextTick(callback);
|
79
78
|
}
|
80
|
-
|
81
79
|
setTimeout(callback, 0);
|
82
80
|
},
|
83
81
|
|
84
|
-
functionName: function (func) {
|
82
|
+
functionName: function functionName(func) {
|
85
83
|
if (!func) return "";
|
86
84
|
if (func.displayName) return func.displayName;
|
87
85
|
if (func.name) return func.name;
|
88
|
-
|
89
86
|
var matches = func.toString().match(/function\s+([^\(]+)/m);
|
90
87
|
return matches && matches[1] || "";
|
91
88
|
},
|
92
89
|
|
93
|
-
isNode: function (obj) {
|
90
|
+
isNode: function isNode(obj) {
|
94
91
|
if (!div) return false;
|
95
|
-
|
96
92
|
try {
|
97
93
|
obj.appendChild(div);
|
98
94
|
obj.removeChild(div);
|
99
95
|
} catch (e) {
|
100
96
|
return false;
|
101
97
|
}
|
102
|
-
|
103
98
|
return true;
|
104
99
|
},
|
105
100
|
|
106
|
-
isElement: function (obj) {
|
107
|
-
return obj &&
|
108
|
-
}
|
109
|
-
});
|
110
|
-
}(buster || {}, setTimeout));
|
101
|
+
isElement: function isElement(obj) {
|
102
|
+
return obj && obj.nodeType === 1 && buster.isNode(obj);
|
103
|
+
},
|
111
104
|
|
112
|
-
|
113
|
-
|
114
|
-
|
105
|
+
isArray: function isArray(arr) {
|
106
|
+
return Object.prototype.toString.call(arr) == "[object Array]";
|
107
|
+
},
|
115
108
|
|
116
|
-
|
117
|
-
|
118
|
-
|
109
|
+
flatten: function flatten(arr) {
|
110
|
+
var result = [], arr = arr || [];
|
111
|
+
for (var i = 0, l = arr.length; i < l; ++i) {
|
112
|
+
result = result.concat(buster.isArray(arr[i]) ? flatten(arr[i]) : arr[i]);
|
113
|
+
}
|
114
|
+
return result;
|
115
|
+
},
|
116
|
+
|
117
|
+
each: function each(arr, callback) {
|
118
|
+
for (var i = 0, l = arr.length; i < l; ++i) {
|
119
|
+
callback(arr[i]);
|
120
|
+
}
|
121
|
+
},
|
122
|
+
|
123
|
+
map: function map(arr, callback) {
|
124
|
+
var results = [];
|
125
|
+
for (var i = 0, l = arr.length; i < l; ++i) {
|
126
|
+
results.push(callback(arr[i]));
|
127
|
+
}
|
128
|
+
return results;
|
129
|
+
},
|
130
|
+
|
131
|
+
parallel: function parallel(fns, callback) {
|
132
|
+
function cb(err, res) {
|
133
|
+
if (typeof callback == "function") {
|
134
|
+
callback(err, res);
|
135
|
+
callback = null;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
if (fns.length == 0) { return cb(null, []); }
|
139
|
+
var remaining = fns.length, results = [];
|
140
|
+
function makeDone(num) {
|
141
|
+
return function done(err, result) {
|
142
|
+
if (err) { return cb(err); }
|
143
|
+
results[num] = result;
|
144
|
+
if (--remaining == 0) { cb(null, results); }
|
145
|
+
};
|
146
|
+
}
|
147
|
+
for (var i = 0, l = fns.length; i < l; ++i) {
|
148
|
+
fns[i](makeDone(i));
|
149
|
+
}
|
150
|
+
},
|
151
|
+
|
152
|
+
series: function series(fns, callback) {
|
153
|
+
function cb(err, res) {
|
154
|
+
if (typeof callback == "function") {
|
155
|
+
callback(err, res);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
var remaining = fns.slice();
|
159
|
+
var results = [];
|
160
|
+
function callNext() {
|
161
|
+
if (remaining.length == 0) return cb(null, results);
|
162
|
+
var promise = remaining.shift()(next);
|
163
|
+
if (promise && typeof promise.then == "function") {
|
164
|
+
promise.then(buster.partial(next, null), next);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
function next(err, result) {
|
168
|
+
if (err) return cb(err);
|
169
|
+
results.push(result);
|
170
|
+
callNext();
|
171
|
+
}
|
172
|
+
callNext();
|
173
|
+
},
|
174
|
+
|
175
|
+
countdown: function countdown(num, done) {
|
176
|
+
return function () {
|
177
|
+
if (--num == 0) done();
|
178
|
+
};
|
119
179
|
}
|
120
|
-
}
|
121
|
-
|
180
|
+
};
|
181
|
+
|
182
|
+
if (typeof process === "object" &&
|
183
|
+
typeof require === "function" && typeof module === "object") {
|
184
|
+
var crypto = require("crypto");
|
185
|
+
var path = require("path");
|
186
|
+
|
187
|
+
buster.tmpFile = function (fileName) {
|
188
|
+
var hashed = crypto.createHash("sha1");
|
189
|
+
hashed.update(fileName);
|
190
|
+
var tmpfileName = hashed.digest("hex");
|
191
|
+
|
192
|
+
if (process.platform == "win32") {
|
193
|
+
return path.join(process.env["TEMP"], tmpfileName);
|
194
|
+
} else {
|
195
|
+
return path.join("/tmp", tmpfileName);
|
196
|
+
}
|
197
|
+
};
|
198
|
+
}
|
199
|
+
|
200
|
+
if (Array.prototype.some) {
|
201
|
+
buster.some = function (arr, fn, thisp) {
|
202
|
+
return arr.some(fn, thisp);
|
203
|
+
};
|
204
|
+
} else {
|
205
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
|
206
|
+
buster.some = function (arr, fun, thisp) {
|
207
|
+
if (arr == null) { throw new TypeError(); }
|
208
|
+
arr = Object(arr);
|
209
|
+
var len = arr.length >>> 0;
|
210
|
+
if (typeof fun !== "function") { throw new TypeError(); }
|
211
|
+
|
212
|
+
for (var i = 0; i < len; i++) {
|
213
|
+
if (arr.hasOwnProperty(i) && fun.call(thisp, arr[i], i, arr)) {
|
214
|
+
return true;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
return false;
|
219
|
+
};
|
220
|
+
}
|
122
221
|
|
222
|
+
if (Array.prototype.filter) {
|
223
|
+
buster.filter = function (arr, fn, thisp) {
|
224
|
+
return arr.filter(fn, thisp);
|
225
|
+
};
|
226
|
+
} else {
|
227
|
+
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter
|
228
|
+
buster.filter = function (fn, thisp) {
|
229
|
+
if (this == null) { throw new TypeError(); }
|
230
|
+
|
231
|
+
var t = Object(this);
|
232
|
+
var len = t.length >>> 0;
|
233
|
+
if (typeof fn != "function") { throw new TypeError(); }
|
234
|
+
|
235
|
+
var res = [];
|
236
|
+
for (var i = 0; i < len; i++) {
|
237
|
+
if (i in t) {
|
238
|
+
var val = t[i]; // in case fun mutates this
|
239
|
+
if (fn.call(thisp, val, i, t)) { res.push(val); }
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
return res;
|
244
|
+
};
|
245
|
+
}
|
123
246
|
|
124
|
-
if (
|
247
|
+
if (isNode) {
|
248
|
+
module.exports = buster;
|
249
|
+
buster.eventEmitter = require("./buster-event-emitter");
|
250
|
+
Object.defineProperty(buster, "defineVersionGetter", {
|
251
|
+
get: function () {
|
252
|
+
return require("./define-version-getter");
|
253
|
+
}
|
254
|
+
});
|
255
|
+
}
|
256
|
+
|
257
|
+
return buster.extend(B || {}, buster);
|
258
|
+
}(setTimeout, buster));
|
259
|
+
if (typeof buster === "undefined") {
|
260
|
+
var buster = {};
|
261
|
+
}
|
262
|
+
|
263
|
+
if (typeof module === "object" && typeof require === "function") {
|
125
264
|
buster = require("buster-core");
|
126
265
|
}
|
127
266
|
|
@@ -130,12 +269,26 @@ buster.format.excludeConstructors = ["Object", /^.$/];
|
|
130
269
|
buster.format.quoteStrings = true;
|
131
270
|
|
132
271
|
buster.format.ascii = (function () {
|
272
|
+
|
273
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
274
|
+
|
275
|
+
var specialObjects = [];
|
276
|
+
if (typeof global != "undefined") {
|
277
|
+
specialObjects.push({ obj: global, value: "[object global]" });
|
278
|
+
}
|
279
|
+
if (typeof document != "undefined") {
|
280
|
+
specialObjects.push({ obj: document, value: "[object HTMLDocument]" });
|
281
|
+
}
|
282
|
+
if (typeof window != "undefined") {
|
283
|
+
specialObjects.push({ obj: window, value: "[object Window]" });
|
284
|
+
}
|
285
|
+
|
133
286
|
function keys(object) {
|
134
287
|
var k = Object.keys && Object.keys(object) || [];
|
135
288
|
|
136
289
|
if (k.length == 0) {
|
137
290
|
for (var prop in object) {
|
138
|
-
if (
|
291
|
+
if (hasOwn.call(object, prop)) {
|
139
292
|
k.push(prop);
|
140
293
|
}
|
141
294
|
}
|
@@ -175,7 +328,7 @@ buster.format.ascii = (function () {
|
|
175
328
|
}
|
176
329
|
|
177
330
|
if (Object.prototype.toString.call(object) == "[object Array]") {
|
178
|
-
return ascii.array(object);
|
331
|
+
return ascii.array.call(this, object, processed);
|
179
332
|
}
|
180
333
|
|
181
334
|
if (!object) {
|
@@ -186,10 +339,17 @@ buster.format.ascii = (function () {
|
|
186
339
|
return ascii.element(object);
|
187
340
|
}
|
188
341
|
|
189
|
-
if (object.toString
|
342
|
+
if (typeof object.toString == "function" &&
|
343
|
+
object.toString !== Object.prototype.toString) {
|
190
344
|
return object.toString();
|
191
345
|
}
|
192
346
|
|
347
|
+
for (var i = 0, l = specialObjects.length; i < l; i++) {
|
348
|
+
if (object === specialObjects[i].obj) {
|
349
|
+
return specialObjects[i].value;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
193
353
|
return ascii.object.call(this, object, processed, indent);
|
194
354
|
}
|
195
355
|
|
@@ -203,7 +363,7 @@ buster.format.ascii = (function () {
|
|
203
363
|
var pieces = [];
|
204
364
|
|
205
365
|
for (var i = 0, l = array.length; i < l; ++i) {
|
206
|
-
pieces.push(ascii(array[i], processed));
|
366
|
+
pieces.push(ascii.call(this, array[i], processed));
|
207
367
|
}
|
208
368
|
|
209
369
|
return "[" + pieces.join(", ") + "]";
|
@@ -376,11 +536,15 @@ var sinon = (function (buster) {
|
|
376
536
|
method.displayName = property;
|
377
537
|
|
378
538
|
method.restore = function () {
|
379
|
-
|
380
|
-
|
381
|
-
|
539
|
+
// For prototype properties try to reset by delete first.
|
540
|
+
// If this fails (ex: localStorage on mobile safari) then force a reset
|
541
|
+
// via direct assignment.
|
542
|
+
if (!owned) {
|
382
543
|
delete object[property];
|
383
544
|
}
|
545
|
+
if (object[property] === method) {
|
546
|
+
object[property] = wrappedMethod;
|
547
|
+
}
|
384
548
|
};
|
385
549
|
|
386
550
|
method.restore.sinon = true;
|
@@ -414,6 +578,9 @@ var sinon = (function (buster) {
|
|
414
578
|
},
|
415
579
|
|
416
580
|
deepEqual: function deepEqual(a, b) {
|
581
|
+
if (sinon.match && sinon.match.isMatcher(a)) {
|
582
|
+
return a.test(b);
|
583
|
+
}
|
417
584
|
if (typeof a != "object" || typeof b != "object") {
|
418
585
|
return a === b;
|
419
586
|
}
|
@@ -565,6 +732,14 @@ var sinon = (function (buster) {
|
|
565
732
|
err.message = msg + err.message;
|
566
733
|
throw err;
|
567
734
|
}, 0);
|
735
|
+
},
|
736
|
+
|
737
|
+
typeOf: function (value) {
|
738
|
+
if (value === null) {
|
739
|
+
return "null";
|
740
|
+
}
|
741
|
+
var string = Object.prototype.toString.call(value);
|
742
|
+
return string.substring(8, string.length - 1).toLowerCase();
|
568
743
|
}
|
569
744
|
};
|
570
745
|
|
@@ -584,6 +759,7 @@ var sinon = (function (buster) {
|
|
584
759
|
module.exports.test = require("./sinon/test");
|
585
760
|
module.exports.testCase = require("./sinon/test_case");
|
586
761
|
module.exports.assert = require("./sinon/assert");
|
762
|
+
module.exports.match = require("./sinon/match");
|
587
763
|
}
|
588
764
|
|
589
765
|
if (buster) {
|
@@ -596,7 +772,7 @@ var sinon = (function (buster) {
|
|
596
772
|
try {
|
597
773
|
var util = require("util");
|
598
774
|
sinon.format = function (value) {
|
599
|
-
return typeof value == "object" ? util.inspect(value) : value;
|
775
|
+
return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
|
600
776
|
};
|
601
777
|
} catch (e) {
|
602
778
|
/* Node, but no util module - would be very old, but better safe than
|
@@ -610,6 +786,248 @@ var sinon = (function (buster) {
|
|
610
786
|
/* @depend ../sinon.js */
|
611
787
|
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
|
612
788
|
/*global module, require, sinon*/
|
789
|
+
/**
|
790
|
+
* Match functions
|
791
|
+
*
|
792
|
+
* @author Maximilian Antoni (mail@maxantoni.de)
|
793
|
+
* @license BSD
|
794
|
+
*
|
795
|
+
* Copyright (c) 2012 Maximilian Antoni
|
796
|
+
*/
|
797
|
+
|
798
|
+
(function (sinon) {
|
799
|
+
var commonJSModule = typeof module == "object" && typeof require == "function";
|
800
|
+
|
801
|
+
if (!sinon && commonJSModule) {
|
802
|
+
sinon = require("../sinon");
|
803
|
+
}
|
804
|
+
|
805
|
+
if (!sinon) {
|
806
|
+
return;
|
807
|
+
}
|
808
|
+
|
809
|
+
function assertType(value, type, name) {
|
810
|
+
var actual = sinon.typeOf(value);
|
811
|
+
if (actual !== type) {
|
812
|
+
throw new TypeError("Expected type of " + name + " to be " +
|
813
|
+
type + ", but was " + actual);
|
814
|
+
}
|
815
|
+
}
|
816
|
+
|
817
|
+
var matcher = {
|
818
|
+
toString: function () {
|
819
|
+
return this.message;
|
820
|
+
}
|
821
|
+
};
|
822
|
+
|
823
|
+
function isMatcher(object) {
|
824
|
+
return matcher.isPrototypeOf(object);
|
825
|
+
}
|
826
|
+
|
827
|
+
function matchObject(expectation, actual) {
|
828
|
+
if (actual === null || actual === undefined) {
|
829
|
+
return false;
|
830
|
+
}
|
831
|
+
for (var key in expectation) {
|
832
|
+
if (expectation.hasOwnProperty(key)) {
|
833
|
+
var exp = expectation[key];
|
834
|
+
var act = actual[key];
|
835
|
+
if (match.isMatcher(exp)) {
|
836
|
+
if (!exp.test(act)) {
|
837
|
+
return false;
|
838
|
+
}
|
839
|
+
} else if (sinon.typeOf(exp) === "object") {
|
840
|
+
if (!matchObject(exp, act)) {
|
841
|
+
return false;
|
842
|
+
}
|
843
|
+
} else if (!sinon.deepEqual(exp, act)) {
|
844
|
+
return false;
|
845
|
+
}
|
846
|
+
}
|
847
|
+
}
|
848
|
+
return true;
|
849
|
+
}
|
850
|
+
|
851
|
+
matcher.or = function (m2) {
|
852
|
+
if (!isMatcher(m2)) {
|
853
|
+
throw new TypeError("Matcher expected");
|
854
|
+
}
|
855
|
+
var m1 = this;
|
856
|
+
var or = sinon.create(matcher);
|
857
|
+
or.test = function (actual) {
|
858
|
+
return m1.test(actual) || m2.test(actual);
|
859
|
+
};
|
860
|
+
or.message = m1.message + ".or(" + m2.message + ")";
|
861
|
+
return or;
|
862
|
+
};
|
863
|
+
|
864
|
+
matcher.and = function (m2) {
|
865
|
+
if (!isMatcher(m2)) {
|
866
|
+
throw new TypeError("Matcher expected");
|
867
|
+
}
|
868
|
+
var m1 = this;
|
869
|
+
var and = sinon.create(matcher);
|
870
|
+
and.test = function (actual) {
|
871
|
+
return m1.test(actual) && m2.test(actual);
|
872
|
+
};
|
873
|
+
and.message = m1.message + ".and(" + m2.message + ")";
|
874
|
+
return and;
|
875
|
+
};
|
876
|
+
|
877
|
+
var match = function (expectation, message) {
|
878
|
+
var m = sinon.create(matcher);
|
879
|
+
var type = sinon.typeOf(expectation);
|
880
|
+
switch (type) {
|
881
|
+
case "object":
|
882
|
+
if (typeof expectation.test === "function") {
|
883
|
+
m.test = function (actual) {
|
884
|
+
return expectation.test(actual) === true;
|
885
|
+
};
|
886
|
+
m.message = "match(" + sinon.functionName(expectation.test) + ")";
|
887
|
+
return m;
|
888
|
+
}
|
889
|
+
var str = [];
|
890
|
+
for (var key in expectation) {
|
891
|
+
if (expectation.hasOwnProperty(key)) {
|
892
|
+
str.push(key + ": " + expectation[key]);
|
893
|
+
}
|
894
|
+
}
|
895
|
+
m.test = function (actual) {
|
896
|
+
return matchObject(expectation, actual);
|
897
|
+
};
|
898
|
+
m.message = "match(" + str.join(", ") + ")";
|
899
|
+
break;
|
900
|
+
case "number":
|
901
|
+
m.test = function (actual) {
|
902
|
+
return expectation == actual;
|
903
|
+
};
|
904
|
+
break;
|
905
|
+
case "string":
|
906
|
+
m.test = function (actual) {
|
907
|
+
if (typeof actual !== "string") {
|
908
|
+
return false;
|
909
|
+
}
|
910
|
+
return actual.indexOf(expectation) !== -1;
|
911
|
+
};
|
912
|
+
m.message = "match(\"" + expectation + "\")";
|
913
|
+
break;
|
914
|
+
case "regexp":
|
915
|
+
m.test = function (actual) {
|
916
|
+
if (typeof actual !== "string") {
|
917
|
+
return false;
|
918
|
+
}
|
919
|
+
return expectation.test(actual);
|
920
|
+
};
|
921
|
+
break;
|
922
|
+
case "function":
|
923
|
+
m.test = expectation;
|
924
|
+
if (message) {
|
925
|
+
m.message = message;
|
926
|
+
} else {
|
927
|
+
m.message = "match(" + sinon.functionName(expectation) + ")";
|
928
|
+
}
|
929
|
+
break;
|
930
|
+
default:
|
931
|
+
m.test = function (actual) {
|
932
|
+
return sinon.deepEqual(expectation, actual);
|
933
|
+
};
|
934
|
+
}
|
935
|
+
if (!m.message) {
|
936
|
+
m.message = "match(" + expectation + ")";
|
937
|
+
}
|
938
|
+
return m;
|
939
|
+
};
|
940
|
+
|
941
|
+
match.isMatcher = isMatcher;
|
942
|
+
|
943
|
+
match.any = match(function () {
|
944
|
+
return true;
|
945
|
+
}, "any");
|
946
|
+
|
947
|
+
match.defined = match(function (actual) {
|
948
|
+
return actual !== null && actual !== undefined;
|
949
|
+
}, "defined");
|
950
|
+
|
951
|
+
match.truthy = match(function (actual) {
|
952
|
+
return !!actual;
|
953
|
+
}, "truthy");
|
954
|
+
|
955
|
+
match.falsy = match(function (actual) {
|
956
|
+
return !actual;
|
957
|
+
}, "falsy");
|
958
|
+
|
959
|
+
match.same = function (expectation) {
|
960
|
+
return match(function (actual) {
|
961
|
+
return expectation === actual;
|
962
|
+
}, "same(" + expectation + ")");
|
963
|
+
};
|
964
|
+
|
965
|
+
match.typeOf = function (type) {
|
966
|
+
assertType(type, "string", "type");
|
967
|
+
return match(function (actual) {
|
968
|
+
return sinon.typeOf(actual) === type;
|
969
|
+
}, "typeOf(\"" + type + "\")");
|
970
|
+
};
|
971
|
+
|
972
|
+
match.instanceOf = function (type) {
|
973
|
+
assertType(type, "function", "type");
|
974
|
+
return match(function (actual) {
|
975
|
+
return actual instanceof type;
|
976
|
+
}, "instanceOf(" + sinon.functionName(type) + ")");
|
977
|
+
};
|
978
|
+
|
979
|
+
function createPropertyMatcher(propertyTest, messagePrefix) {
|
980
|
+
return function (property, value) {
|
981
|
+
assertType(property, "string", "property");
|
982
|
+
var onlyProperty = arguments.length === 1;
|
983
|
+
var message = messagePrefix + "(\"" + property + "\"";
|
984
|
+
if (!onlyProperty) {
|
985
|
+
message += ", " + value;
|
986
|
+
}
|
987
|
+
message += ")";
|
988
|
+
return match(function (actual) {
|
989
|
+
if (actual === undefined || actual === null ||
|
990
|
+
!propertyTest(actual, property)) {
|
991
|
+
return false;
|
992
|
+
}
|
993
|
+
return onlyProperty || sinon.deepEqual(value, actual[property]);
|
994
|
+
}, message);
|
995
|
+
};
|
996
|
+
}
|
997
|
+
|
998
|
+
match.has = createPropertyMatcher(function (actual, property) {
|
999
|
+
if (typeof actual === "object") {
|
1000
|
+
return property in actual;
|
1001
|
+
}
|
1002
|
+
return actual[property] !== undefined;
|
1003
|
+
}, "has");
|
1004
|
+
|
1005
|
+
match.hasOwn = createPropertyMatcher(function (actual, property) {
|
1006
|
+
return actual.hasOwnProperty(property);
|
1007
|
+
}, "hasOwn");
|
1008
|
+
|
1009
|
+
match.bool = match.typeOf("boolean");
|
1010
|
+
match.number = match.typeOf("number");
|
1011
|
+
match.string = match.typeOf("string");
|
1012
|
+
match.object = match.typeOf("object");
|
1013
|
+
match.func = match.typeOf("function");
|
1014
|
+
match.array = match.typeOf("array");
|
1015
|
+
match.regexp = match.typeOf("regexp");
|
1016
|
+
match.date = match.typeOf("date");
|
1017
|
+
|
1018
|
+
if (commonJSModule) {
|
1019
|
+
module.exports = match;
|
1020
|
+
} else {
|
1021
|
+
sinon.match = match;
|
1022
|
+
}
|
1023
|
+
}(typeof sinon == "object" && sinon || null));
|
1024
|
+
|
1025
|
+
/**
|
1026
|
+
* @depend ../sinon.js
|
1027
|
+
* @depend match.js
|
1028
|
+
*/
|
1029
|
+
/*jslint eqeqeq: false, onevar: false, plusplus: false*/
|
1030
|
+
/*global module, require, sinon*/
|
613
1031
|
/**
|
614
1032
|
* Spy functions
|
615
1033
|
*
|
@@ -639,7 +1057,7 @@ var sinon = (function (buster) {
|
|
639
1057
|
return spy.create(object);
|
640
1058
|
}
|
641
1059
|
|
642
|
-
if (!object
|
1060
|
+
if (!object && !property) {
|
643
1061
|
return spy.create(function () {});
|
644
1062
|
}
|
645
1063
|
|
@@ -694,6 +1112,7 @@ var sinon = (function (buster) {
|
|
694
1112
|
function incrementCallCount() {
|
695
1113
|
this.called = true;
|
696
1114
|
this.callCount += 1;
|
1115
|
+
this.notCalled = false;
|
697
1116
|
this.calledOnce = this.callCount == 1;
|
698
1117
|
this.calledTwice = this.callCount == 2;
|
699
1118
|
this.calledThrice = this.callCount == 3;
|
@@ -712,6 +1131,7 @@ var sinon = (function (buster) {
|
|
712
1131
|
var spyApi = {
|
713
1132
|
reset: function () {
|
714
1133
|
this.called = false;
|
1134
|
+
this.notCalled = true;
|
715
1135
|
this.calledOnce = false;
|
716
1136
|
this.calledTwice = false;
|
717
1137
|
this.calledThrice = false;
|
@@ -725,6 +1145,11 @@ var sinon = (function (buster) {
|
|
725
1145
|
this.thisValues = [];
|
726
1146
|
this.exceptions = [];
|
727
1147
|
this.callIds = [];
|
1148
|
+
if (this.fakes) {
|
1149
|
+
for (var i = 0; i < this.fakes.length; i++) {
|
1150
|
+
this.fakes[i].reset();
|
1151
|
+
}
|
1152
|
+
}
|
728
1153
|
},
|
729
1154
|
|
730
1155
|
create: function create(func) {
|
@@ -882,11 +1307,15 @@ var sinon = (function (buster) {
|
|
882
1307
|
delegateToCalls(spyApi, "calledOn", true);
|
883
1308
|
delegateToCalls(spyApi, "alwaysCalledOn", false, "calledOn");
|
884
1309
|
delegateToCalls(spyApi, "calledWith", true);
|
1310
|
+
delegateToCalls(spyApi, "calledWithMatch", true);
|
885
1311
|
delegateToCalls(spyApi, "alwaysCalledWith", false, "calledWith");
|
1312
|
+
delegateToCalls(spyApi, "alwaysCalledWithMatch", false, "calledWithMatch");
|
886
1313
|
delegateToCalls(spyApi, "calledWithExactly", true);
|
887
1314
|
delegateToCalls(spyApi, "alwaysCalledWithExactly", false, "calledWithExactly");
|
888
1315
|
delegateToCalls(spyApi, "neverCalledWith", false, "notCalledWith",
|
889
1316
|
function () { return true; });
|
1317
|
+
delegateToCalls(spyApi, "neverCalledWithMatch", false, "notCalledWithMatch",
|
1318
|
+
function () { return true; });
|
890
1319
|
delegateToCalls(spyApi, "threw", true);
|
891
1320
|
delegateToCalls(spyApi, "alwaysThrew", false, "threw");
|
892
1321
|
delegateToCalls(spyApi, "returned", true);
|
@@ -937,7 +1366,13 @@ var sinon = (function (buster) {
|
|
937
1366
|
},
|
938
1367
|
|
939
1368
|
"*": function (spy, args) {
|
940
|
-
|
1369
|
+
var formatted = [];
|
1370
|
+
|
1371
|
+
for (var i = 0, l = args.length; i < l; ++i) {
|
1372
|
+
push.call(formatted, sinon.format(args[i]));
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
return formatted.join(", ");
|
941
1376
|
}
|
942
1377
|
};
|
943
1378
|
|
@@ -982,22 +1417,32 @@ var sinon = (function (buster) {
|
|
982
1417
|
return true;
|
983
1418
|
},
|
984
1419
|
|
1420
|
+
calledWithMatch: function calledWithMatch() {
|
1421
|
+
for (var i = 0, l = arguments.length; i < l; i += 1) {
|
1422
|
+
var actual = this.args[i];
|
1423
|
+
var expectation = arguments[i];
|
1424
|
+
if (!sinon.match || !sinon.match(expectation).test(actual)) {
|
1425
|
+
return false;
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
return true;
|
1429
|
+
},
|
1430
|
+
|
985
1431
|
calledWithExactly: function calledWithExactly() {
|
986
1432
|
return arguments.length == this.args.length &&
|
987
1433
|
this.calledWith.apply(this, arguments);
|
988
1434
|
},
|
989
1435
|
|
990
1436
|
notCalledWith: function notCalledWith() {
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
return false;
|
1437
|
+
return !this.calledWith.apply(this, arguments);
|
1438
|
+
},
|
1439
|
+
|
1440
|
+
notCalledWithMatch: function notCalledWithMatch() {
|
1441
|
+
return !this.calledWithMatch.apply(this, arguments);
|
997
1442
|
},
|
998
1443
|
|
999
1444
|
returned: function returned(value) {
|
1000
|
-
return this.returnValue
|
1445
|
+
return sinon.deepEqual(value, this.returnValue);
|
1001
1446
|
},
|
1002
1447
|
|
1003
1448
|
threw: function threw(error) {
|
@@ -1195,6 +1640,20 @@ var sinon = (function (buster) {
|
|
1195
1640
|
return "argument at index " + stub.callArgAt + " is not a function: " + func;
|
1196
1641
|
}
|
1197
1642
|
|
1643
|
+
var nextTick = (function () {
|
1644
|
+
if (typeof process === "object" && typeof process.nextTick === "function") {
|
1645
|
+
return process.nextTick;
|
1646
|
+
} else if (typeof msSetImmediate === "function") {
|
1647
|
+
return msSetImmediate.bind(window);
|
1648
|
+
} else if (typeof setImmediate === "function") {
|
1649
|
+
return setImmediate;
|
1650
|
+
} else {
|
1651
|
+
return function (callback) {
|
1652
|
+
setTimeout(callback, 0);
|
1653
|
+
};
|
1654
|
+
}
|
1655
|
+
})();
|
1656
|
+
|
1198
1657
|
function callCallback(stub, args) {
|
1199
1658
|
if (typeof stub.callArgAt == "number") {
|
1200
1659
|
var func = getCallback(stub, args);
|
@@ -1203,14 +1662,20 @@ var sinon = (function (buster) {
|
|
1203
1662
|
throw new TypeError(getCallbackError(stub, func, args));
|
1204
1663
|
}
|
1205
1664
|
|
1206
|
-
|
1665
|
+
if (stub.callbackAsync) {
|
1666
|
+
nextTick(function() {
|
1667
|
+
func.apply(stub.callbackContext, stub.callbackArguments);
|
1668
|
+
});
|
1669
|
+
} else {
|
1670
|
+
func.apply(stub.callbackContext, stub.callbackArguments);
|
1671
|
+
}
|
1207
1672
|
}
|
1208
1673
|
}
|
1209
1674
|
|
1210
1675
|
var uuid = 0;
|
1211
1676
|
|
1212
1677
|
sinon.extend(stub, (function () {
|
1213
|
-
var slice = Array.prototype.slice;
|
1678
|
+
var slice = Array.prototype.slice, proto;
|
1214
1679
|
|
1215
1680
|
function throwsException(error, message) {
|
1216
1681
|
if (typeof error == "string") {
|
@@ -1221,21 +1686,23 @@ var sinon = (function (buster) {
|
|
1221
1686
|
} else {
|
1222
1687
|
this.exception = error;
|
1223
1688
|
}
|
1224
|
-
|
1689
|
+
|
1225
1690
|
return this;
|
1226
1691
|
}
|
1227
1692
|
|
1228
|
-
|
1693
|
+
proto = {
|
1229
1694
|
create: function create() {
|
1230
1695
|
var functionStub = function () {
|
1696
|
+
|
1697
|
+
callCallback(functionStub, arguments);
|
1698
|
+
|
1231
1699
|
if (functionStub.exception) {
|
1232
1700
|
throw functionStub.exception;
|
1233
1701
|
} else if (typeof functionStub.returnArgAt == 'number') {
|
1234
1702
|
return arguments[functionStub.returnArgAt];
|
1703
|
+
} else if (functionStub.returnThis) {
|
1704
|
+
return this;
|
1235
1705
|
}
|
1236
|
-
|
1237
|
-
callCallback(functionStub, arguments);
|
1238
|
-
|
1239
1706
|
return functionStub.returnValue;
|
1240
1707
|
};
|
1241
1708
|
|
@@ -1262,12 +1729,18 @@ var sinon = (function (buster) {
|
|
1262
1729
|
if (typeof pos != "number") {
|
1263
1730
|
throw new TypeError("argument index is not number");
|
1264
1731
|
}
|
1265
|
-
|
1732
|
+
|
1266
1733
|
this.returnArgAt = pos;
|
1267
1734
|
|
1268
1735
|
return this;
|
1269
1736
|
},
|
1270
1737
|
|
1738
|
+
returnsThis: function returnsThis() {
|
1739
|
+
this.returnThis = true;
|
1740
|
+
|
1741
|
+
return this;
|
1742
|
+
},
|
1743
|
+
|
1271
1744
|
"throws": throwsException,
|
1272
1745
|
throwsException: throwsException,
|
1273
1746
|
|
@@ -1363,6 +1836,21 @@ var sinon = (function (buster) {
|
|
1363
1836
|
return this;
|
1364
1837
|
}
|
1365
1838
|
};
|
1839
|
+
|
1840
|
+
// create asynchronous versions of callsArg* and yields* methods
|
1841
|
+
for (var method in proto) {
|
1842
|
+
if (proto.hasOwnProperty(method) && method.match(/^(callsArg|yields)/)) {
|
1843
|
+
proto[method + 'Async'] = (function (syncFnName) {
|
1844
|
+
return function () {
|
1845
|
+
this.callbackAsync = true;
|
1846
|
+
return this[syncFnName].apply(this, arguments);
|
1847
|
+
};
|
1848
|
+
})(method);
|
1849
|
+
}
|
1850
|
+
}
|
1851
|
+
|
1852
|
+
return proto;
|
1853
|
+
|
1366
1854
|
}()));
|
1367
1855
|
|
1368
1856
|
if (commonJSModule) {
|
@@ -1488,6 +1976,8 @@ var sinon = (function (buster) {
|
|
1488
1976
|
|
1489
1977
|
if (messages.length > 0) {
|
1490
1978
|
sinon.expectation.fail(messages.concat(met).join("\n"));
|
1979
|
+
} else {
|
1980
|
+
sinon.expectation.pass(messages.concat(met).join("\n"));
|
1491
1981
|
}
|
1492
1982
|
|
1493
1983
|
return true;
|
@@ -1495,21 +1985,30 @@ var sinon = (function (buster) {
|
|
1495
1985
|
|
1496
1986
|
invokeMethod: function invokeMethod(method, thisValue, args) {
|
1497
1987
|
var expectations = this.expectations && this.expectations[method];
|
1498
|
-
var length = expectations && expectations.length || 0;
|
1988
|
+
var length = expectations && expectations.length || 0, i;
|
1499
1989
|
|
1500
|
-
for (
|
1990
|
+
for (i = 0; i < length; i += 1) {
|
1501
1991
|
if (!expectations[i].met() &&
|
1502
1992
|
expectations[i].allowsCall(thisValue, args)) {
|
1503
1993
|
return expectations[i].apply(thisValue, args);
|
1504
1994
|
}
|
1505
1995
|
}
|
1506
1996
|
|
1507
|
-
var messages = [];
|
1997
|
+
var messages = [], available, exhausted = 0;
|
1508
1998
|
|
1509
1999
|
for (i = 0; i < length; i += 1) {
|
2000
|
+
if (expectations[i].allowsCall(thisValue, args)) {
|
2001
|
+
available = available || expectations[i];
|
2002
|
+
} else {
|
2003
|
+
exhausted += 1;
|
2004
|
+
}
|
1510
2005
|
push.call(messages, " " + expectations[i].toString());
|
1511
2006
|
}
|
1512
2007
|
|
2008
|
+
if (exhausted === 0) {
|
2009
|
+
return available.apply(thisValue, args);
|
2010
|
+
}
|
2011
|
+
|
1513
2012
|
messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({
|
1514
2013
|
proxy: method,
|
1515
2014
|
args: args
|
@@ -1660,7 +2159,7 @@ var sinon = (function (buster) {
|
|
1660
2159
|
return;
|
1661
2160
|
}
|
1662
2161
|
|
1663
|
-
if (!args
|
2162
|
+
if (!args) {
|
1664
2163
|
sinon.expectation.fail(this.method + " received no arguments, expected " +
|
1665
2164
|
this.expectedArguments.join());
|
1666
2165
|
}
|
@@ -1685,7 +2184,7 @@ var sinon = (function (buster) {
|
|
1685
2184
|
},
|
1686
2185
|
|
1687
2186
|
allowsCall: function allowsCall(thisValue, args) {
|
1688
|
-
if (this.met()) {
|
2187
|
+
if (this.met() && receivedMaxCalls(this)) {
|
1689
2188
|
return false;
|
1690
2189
|
}
|
1691
2190
|
|
@@ -1758,11 +2257,16 @@ var sinon = (function (buster) {
|
|
1758
2257
|
verify: function verify() {
|
1759
2258
|
if (!this.met()) {
|
1760
2259
|
sinon.expectation.fail(this.toString());
|
2260
|
+
} else {
|
2261
|
+
sinon.expectation.pass(this.toString());
|
1761
2262
|
}
|
1762
2263
|
|
1763
2264
|
return true;
|
1764
2265
|
},
|
1765
2266
|
|
2267
|
+
pass: function(message) {
|
2268
|
+
sinon.assert.pass(message);
|
2269
|
+
},
|
1766
2270
|
fail: function (message) {
|
1767
2271
|
var exception = new Error(message);
|
1768
2272
|
exception.name = "ExpectationError";
|
@@ -1886,6 +2390,17 @@ var sinon = (function (buster) {
|
|
1886
2390
|
});
|
1887
2391
|
}
|
1888
2392
|
}
|
2393
|
+
if (!property && !!object && typeof object == "object") {
|
2394
|
+
var stubbedObj = sinon.stub.apply(sinon, arguments);
|
2395
|
+
|
2396
|
+
for (var prop in stubbedObj) {
|
2397
|
+
if (typeof stubbedObj[prop] === "function") {
|
2398
|
+
this.add(stubbedObj[prop]);
|
2399
|
+
}
|
2400
|
+
}
|
2401
|
+
|
2402
|
+
return stubbedObj;
|
2403
|
+
}
|
1889
2404
|
|
1890
2405
|
return this.add(sinon.stub.apply(sinon, arguments));
|
1891
2406
|
},
|
@@ -1962,7 +2477,8 @@ if (typeof sinon == "undefined") {
|
|
1962
2477
|
this.timeouts[toId] = {
|
1963
2478
|
id: toId,
|
1964
2479
|
func: args[0],
|
1965
|
-
callAt: this.now + delay
|
2480
|
+
callAt: this.now + delay,
|
2481
|
+
invokeArgs: Array.prototype.slice.call(args, 2)
|
1966
2482
|
};
|
1967
2483
|
|
1968
2484
|
if (recurring === true) {
|
@@ -2096,7 +2612,8 @@ if (typeof sinon == "undefined") {
|
|
2096
2612
|
func: this.timeouts[id].func,
|
2097
2613
|
callAt: this.timeouts[id].callAt,
|
2098
2614
|
interval: this.timeouts[id].interval,
|
2099
|
-
id: this.timeouts[id].id
|
2615
|
+
id: this.timeouts[id].id,
|
2616
|
+
invokeArgs: this.timeouts[id].invokeArgs
|
2100
2617
|
};
|
2101
2618
|
}
|
2102
2619
|
}
|
@@ -2106,9 +2623,15 @@ if (typeof sinon == "undefined") {
|
|
2106
2623
|
},
|
2107
2624
|
|
2108
2625
|
callTimer: function (timer) {
|
2626
|
+
if (typeof timer.interval == "number") {
|
2627
|
+
this.timeouts[timer.id].callAt += timer.interval;
|
2628
|
+
} else {
|
2629
|
+
delete this.timeouts[timer.id];
|
2630
|
+
}
|
2631
|
+
|
2109
2632
|
try {
|
2110
2633
|
if (typeof timer.func == "function") {
|
2111
|
-
timer.func.
|
2634
|
+
timer.func.apply(null, timer.invokeArgs);
|
2112
2635
|
} else {
|
2113
2636
|
eval(timer.func);
|
2114
2637
|
}
|
@@ -2123,12 +2646,6 @@ if (typeof sinon == "undefined") {
|
|
2123
2646
|
return;
|
2124
2647
|
}
|
2125
2648
|
|
2126
|
-
if (typeof timer.interval == "number") {
|
2127
|
-
this.timeouts[timer.id].callAt += timer.interval;
|
2128
|
-
} else {
|
2129
|
-
delete this.timeouts[timer.id];
|
2130
|
-
}
|
2131
|
-
|
2132
2649
|
if (exception) {
|
2133
2650
|
throw exception;
|
2134
2651
|
}
|
@@ -2204,11 +2721,19 @@ if (typeof sinon == "undefined") {
|
|
2204
2721
|
|
2205
2722
|
for (var i = 0, l = this.methods.length; i < l; i++) {
|
2206
2723
|
method = this.methods[i];
|
2207
|
-
global[method]
|
2724
|
+
if (global[method].hadOwnProperty) {
|
2725
|
+
global[method] = this["_" + method];
|
2726
|
+
} else {
|
2727
|
+
delete global[method];
|
2728
|
+
}
|
2208
2729
|
}
|
2730
|
+
|
2731
|
+
// Prevent multiple executions which will completely remove these props
|
2732
|
+
this.methods = [];
|
2209
2733
|
}
|
2210
2734
|
|
2211
2735
|
function stubGlobal(method, clock) {
|
2736
|
+
clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(global, method);
|
2212
2737
|
clock["_" + method] = global[method];
|
2213
2738
|
|
2214
2739
|
if (method == "Date") {
|
@@ -2849,7 +3374,7 @@ sinon.fakeServer = (function () {
|
|
2849
3374
|
return response;
|
2850
3375
|
}
|
2851
3376
|
|
2852
|
-
var wloc = window.location;
|
3377
|
+
var wloc = typeof window !== "undefined" ? window.location : {};
|
2853
3378
|
var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
|
2854
3379
|
|
2855
3380
|
function matchOne(response, reqMethod, reqUrl) {
|
@@ -3533,11 +4058,16 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3533
4058
|
mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C");
|
3534
4059
|
mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
|
3535
4060
|
mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
|
4061
|
+
mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
|
4062
|
+
mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new");
|
3536
4063
|
mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C");
|
4064
|
+
mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C");
|
3537
4065
|
mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C");
|
4066
|
+
mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C");
|
3538
4067
|
mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C");
|
3539
4068
|
mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
|
3540
4069
|
mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C");
|
4070
|
+
mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C");
|
3541
4071
|
mirrorPropAsAssertion("threw", "%n did not throw exception%C");
|
3542
4072
|
mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
|
3543
4073
|
|
@@ -3548,5 +4078,4 @@ if (typeof module == "object" && typeof require == "function") {
|
|
3548
4078
|
}
|
3549
4079
|
}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : global));
|
3550
4080
|
|
3551
|
-
return sinon;}.call(typeof window != 'undefined' && window || {}));
|
3552
|
-
|
4081
|
+
return sinon;}.call(typeof window != 'undefined' && window || {}));
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinon-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project:
|
51
|
-
rubygems_version: 1.8.
|
51
|
+
rubygems_version: 1.8.23
|
52
52
|
signing_key:
|
53
53
|
specification_version: 3
|
54
54
|
summary: sinon.js via asset pipeline
|