teabag 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/app/assets/javascripts/teabag-mocha.js +154 -123
  2. data/app/assets/javascripts/teabag-qunit.js +401 -195
  3. data/app/assets/javascripts/teabag-teabag.js +3 -4
  4. data/app/assets/javascripts/teabag/mocha.coffee +1 -1
  5. data/app/assets/javascripts/teabag/mocha/reporters/html.coffee +1 -1
  6. data/app/assets/javascripts/teabag/qunit.coffee +1 -1
  7. data/app/assets/javascripts/teabag/qunit/reporters/html.coffee +1 -1
  8. data/app/assets/javascripts/teabag/teabag.coffee +1 -0
  9. data/lib/teabag/version.rb +1 -1
  10. data/spec/dummy/log/development.log +18711 -0
  11. data/spec/dummy/log/test.log +632 -0
  12. data/spec/dummy/tmp/cache/assets/C35/A30/sprockets%2F29906bf540f7d2e081088494b2554989 +0 -0
  13. data/spec/dummy/tmp/cache/assets/C4E/9B0/sprockets%2Fa807397434c9262c3d62da3e91152184 +0 -0
  14. data/spec/dummy/tmp/cache/assets/C5B/D00/sprockets%2F01f43815683089878e371a5d078d3e2c +0 -0
  15. data/spec/dummy/tmp/cache/assets/C72/150/sprockets%2F4194031b4b51b6422c14ac697e3455e5 +0 -0
  16. data/spec/dummy/tmp/cache/assets/C75/D50/sprockets%2F5302968a40e08d2c011aa38666d273f6 +0 -0
  17. data/spec/dummy/tmp/cache/assets/C78/F80/sprockets%2F9161622ddd251097a4ab816b8220984c +0 -0
  18. data/spec/dummy/tmp/cache/assets/C7C/AC0/sprockets%2F29124be1160817c61bb4878894b2ba55 +0 -0
  19. data/spec/dummy/tmp/cache/assets/C7D/8F0/sprockets%2Ff13d01b85f2449a4f0638ff260425906 +0 -0
  20. data/spec/dummy/tmp/cache/assets/C7E/E80/sprockets%2F38544f84f61bb3942d24104e39e108c4 +0 -0
  21. data/spec/dummy/tmp/cache/assets/C85/6E0/sprockets%2F9e583044ba9762ac39f15431ed504495 +0 -0
  22. data/spec/dummy/tmp/cache/assets/C8A/460/sprockets%2F77bffd9959420103906722b404ae8d59 +0 -0
  23. data/spec/dummy/tmp/cache/assets/C91/FA0/sprockets%2F2eb81283f5789ae91a69344552db3856 +0 -0
  24. data/spec/dummy/tmp/cache/assets/C97/430/sprockets%2Fc049582fd1c9178ff983323f75326f64 +0 -0
  25. data/spec/dummy/tmp/cache/assets/C9D/E90/sprockets%2F3045c9533f179d3e1c805d163ed002a0 +0 -0
  26. data/spec/dummy/tmp/cache/assets/CA3/C80/sprockets%2F00916393d1e2e947ddafa91701411a73 +0 -0
  27. data/spec/dummy/tmp/cache/assets/CA6/DF0/sprockets%2F7da83747ce56e49393b6b8726587f846 +0 -0
  28. data/spec/dummy/tmp/cache/assets/CA9/C40/sprockets%2F932b7e2cd1e067289ab51190800814df +0 -0
  29. data/spec/dummy/tmp/cache/assets/CAD/410/sprockets%2F651414e5c7e86f05c5108dc71626b25c +0 -0
  30. data/spec/dummy/tmp/cache/assets/CAF/0F0/sprockets%2F6000e67cf3f2377f860c24da7c819701 +0 -0
  31. data/spec/dummy/tmp/cache/assets/CB0/700/sprockets%2F006af6bf0f6b55777b03c4615c853881 +0 -0
  32. data/spec/dummy/tmp/cache/assets/CB1/B50/sprockets%2F44b5b96ee7652d66a217a1756431c4a8 +0 -0
  33. data/spec/dummy/tmp/cache/assets/CB6/120/sprockets%2F2df706e820de0f82332a613c49f47867 +0 -0
  34. data/spec/dummy/tmp/cache/assets/CBB/FA0/sprockets%2F74922109263bdc965b2e9567eec6d154 +0 -0
  35. data/spec/dummy/tmp/cache/assets/CBD/AF0/sprockets%2Fd687ec33822256e9444e8cd04f1b4873 +0 -0
  36. data/spec/dummy/tmp/cache/assets/CBF/630/sprockets%2F707d2db81468088470d476abff35388d +0 -0
  37. data/spec/dummy/tmp/cache/assets/CC2/EC0/sprockets%2F76bf80cb571ca530357f78db78167866 +0 -0
  38. data/spec/dummy/tmp/cache/assets/CCB/3B0/sprockets%2F9535146026add9cffa012ee220204a66 +0 -0
  39. data/spec/dummy/tmp/cache/assets/CCC/DB0/sprockets%2F3998958d61cda73452466f5652ed81ef +0 -0
  40. data/spec/dummy/tmp/cache/assets/CCE/C50/sprockets%2Fe12774c2fea852112414bb379a71f31a +0 -0
  41. data/spec/dummy/tmp/cache/assets/CD3/460/sprockets%2F7f3f6802b0b309ed142d0b671c9640c4 +0 -0
  42. data/spec/dummy/tmp/cache/assets/CD6/DD0/sprockets%2F301bd3b0e19eb866905681d03a891be3 +0 -0
  43. data/spec/dummy/tmp/cache/assets/CE0/090/sprockets%2F48d5d35ae87d0723318b8bc257fa2237 +0 -0
  44. data/spec/dummy/tmp/cache/assets/CE3/1F0/sprockets%2Fe69a515d3a9d14c669be8871012a7d07 +0 -0
  45. data/spec/dummy/tmp/cache/assets/CE4/190/sprockets%2F36c9ee4181433e33e07eb9748d218ae2 +0 -0
  46. data/spec/dummy/tmp/cache/assets/CE6/270/sprockets%2F2c98152560d18470fec8cf4c6829b4d0 +0 -0
  47. data/spec/dummy/tmp/cache/assets/CE6/7C0/sprockets%2Fa03a2c86ce6724be8542295e1cf24798 +0 -0
  48. data/spec/dummy/tmp/cache/assets/CE7/A60/sprockets%2Ff58eee249aa167d23f8220087bb46684 +0 -0
  49. data/spec/dummy/tmp/cache/assets/CE9/9E0/sprockets%2F135480d497ed7e4884462dc0ef0b80d7 +0 -0
  50. data/spec/dummy/tmp/cache/assets/CEB/680/sprockets%2F67f0794ef8c0576d5c7da34f4437305a +0 -0
  51. data/spec/dummy/tmp/cache/assets/CEB/B40/sprockets%2F1150bf8d912aa100a132251eefaf6045 +0 -0
  52. data/spec/dummy/tmp/cache/assets/CEC/360/sprockets%2F264b79dde726b36d63fee272a0609469 +0 -0
  53. data/spec/dummy/tmp/cache/assets/CEE/930/sprockets%2Fe196521e15fd8d33e3261d5538fe8f92 +0 -0
  54. data/spec/dummy/tmp/cache/assets/CEF/650/sprockets%2Fe859309c630f7637a53d381b327df8fd +0 -0
  55. data/spec/dummy/tmp/cache/assets/CEF/840/sprockets%2F16c7d195fa548e8343c6a4d2256ed778 +0 -0
  56. data/spec/dummy/tmp/cache/assets/CF1/C50/sprockets%2F57bd9ac92067ea01882feef075582758 +0 -0
  57. data/spec/dummy/tmp/cache/assets/CF3/3A0/sprockets%2F6571249b82eb52e7c7e035c692df9b69 +0 -0
  58. data/spec/dummy/tmp/cache/assets/CF3/C50/sprockets%2F892b968b622f37b988a1de81e09bf631 +0 -0
  59. data/spec/dummy/tmp/cache/assets/CF8/780/sprockets%2F8845b81ff27cdb57c835836c9f91a265 +0 -0
  60. data/spec/dummy/tmp/cache/assets/CFA/D20/sprockets%2Fb26796b39b3c5d6ed70be7989637a493 +0 -0
  61. data/spec/dummy/tmp/cache/assets/CFB/210/sprockets%2F9104695bfbf9a9d4b94382e6e90487a9 +0 -0
  62. data/spec/dummy/tmp/cache/assets/CFC/380/sprockets%2Fa7443cbd671446a589867dd5f4a4f989 +0 -0
  63. data/spec/dummy/tmp/cache/assets/D00/110/sprockets%2F6a6353b7723a8b21708e0fbfe04bd422 +0 -0
  64. data/spec/dummy/tmp/cache/assets/D00/F60/sprockets%2F42e279b52511c47d26c0adb125fd04e8 +0 -0
  65. data/spec/dummy/tmp/cache/assets/D02/570/sprockets%2F51fa8dc514e6256ae0836d5eb24e0312 +0 -0
  66. data/spec/dummy/tmp/cache/assets/D03/630/sprockets%2F5d8da32dba6a7be70426a1d554773701 +0 -0
  67. data/spec/dummy/tmp/cache/assets/D04/170/sprockets%2F76ab1dc02e6c7618852708a1e05a2df3 +0 -0
  68. data/spec/dummy/tmp/cache/assets/D04/480/sprockets%2F8bd8f10500b21d2f9d94e4cd1401c936 +0 -0
  69. data/spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d +0 -0
  70. data/spec/dummy/tmp/cache/assets/D09/BF0/sprockets%2F9e6bca5d26f50d9484385d51ba04312c +0 -0
  71. data/spec/dummy/tmp/cache/assets/D0B/210/sprockets%2Fb95ce127097fba0e4019f633e91b730d +0 -0
  72. data/spec/dummy/tmp/cache/assets/D0E/570/sprockets%2F90fe371bf8091e88a712124d9cdae260 +0 -0
  73. data/spec/dummy/tmp/cache/assets/D11/080/sprockets%2Fe202468befa786e2a3e7c6d5980b2333 +0 -0
  74. data/spec/dummy/tmp/cache/assets/D15/750/sprockets%2F8effdd3e668a4036260a3e370f3b6657 +0 -0
  75. data/spec/dummy/tmp/cache/assets/D17/710/sprockets%2Ffa49fb6823d466e79a195e0cd71340c5 +0 -0
  76. data/spec/dummy/tmp/cache/assets/D1D/560/sprockets%2F1ca784ee7ba1922465147e7f8963eae5 +0 -0
  77. data/spec/dummy/tmp/cache/assets/D1E/AA0/sprockets%2F5c8741a556bc955cd36e61c88582b6dc +0 -0
  78. data/spec/dummy/tmp/cache/assets/D22/4D0/sprockets%2Fe94f07f16b94d5cf185c48023f98f1b7 +0 -0
  79. data/spec/dummy/tmp/cache/assets/D2D/060/sprockets%2F545ec7a363badb5e7106e5112b53b26d +0 -0
  80. data/spec/dummy/tmp/cache/assets/D30/740/sprockets%2F4ac342b2e0244e90d08bac61f54f4f82 +0 -0
  81. data/spec/dummy/tmp/cache/assets/D31/9C0/sprockets%2Fbd102a4f5a4985c3519dd6ab0295a1c6 +0 -0
  82. data/spec/dummy/tmp/cache/assets/D35/7C0/sprockets%2Ff536a2606eaf7d542c0985104cb62baf +0 -0
  83. data/spec/dummy/tmp/cache/assets/D37/FF0/sprockets%2F96841ca4cfae32c515077f3f5fc303b2 +0 -0
  84. data/spec/dummy/tmp/cache/assets/D3C/840/sprockets%2Fc6202ec91d567a85bd3d46dc43ea9108 +0 -0
  85. data/spec/dummy/tmp/cache/assets/D44/0F0/sprockets%2Fc4d293b967c2e290deed3f3bd2271828 +0 -0
  86. data/spec/dummy/tmp/cache/assets/D44/E90/sprockets%2F05cfc0bf7c9938963d1d1c63248db80d +0 -0
  87. data/spec/dummy/tmp/cache/assets/D45/C30/sprockets%2Fcc744877558178a3adb77c441cadce70 +0 -0
  88. data/spec/dummy/tmp/cache/assets/D48/BA0/sprockets%2F30a5bfc94bac88df67501fc509b84694 +0 -0
  89. data/spec/dummy/tmp/cache/assets/D49/A10/sprockets%2Fc4656bd995a6f297c26d19b13aadb963 +0 -0
  90. data/spec/dummy/tmp/cache/assets/D4A/580/sprockets%2F19b8d8a9a57850de79b6c099fb2d010e +0 -0
  91. data/spec/dummy/tmp/cache/assets/D50/D70/sprockets%2Fe2a3e6c95b11e0801a4eebae3a026026 +0 -0
  92. data/spec/dummy/tmp/cache/assets/D51/400/sprockets%2Ff5e433d8a31e80985b75ce598de236be +0 -0
  93. data/spec/dummy/tmp/cache/assets/D54/D80/sprockets%2F631327e25ec20edc723046cdec3bb1c0 +0 -0
  94. data/spec/dummy/tmp/cache/assets/D5C/710/sprockets%2F9427d05cee2caa721241a25a9af1d08f +0 -0
  95. data/spec/dummy/tmp/cache/assets/D5C/CC0/sprockets%2Faa8bf6de211f2765b0a26f112b971f0c +0 -0
  96. data/spec/dummy/tmp/cache/assets/D61/1F0/sprockets%2F0c7a6176d2fc4db00bb9a74d36380fe1 +0 -0
  97. data/spec/dummy/tmp/cache/assets/D63/050/sprockets%2Fae26cd0ae2c0da97e49f6043b91008d5 +0 -0
  98. data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F35d2c2b45981ade5a2db2a9c7f37a615 +0 -0
  99. data/spec/dummy/tmp/cache/assets/D67/C20/sprockets%2F0d30bf27e5f74bbd85f313cb8d3c4623 +0 -0
  100. data/spec/dummy/tmp/cache/assets/D69/F90/sprockets%2F6a0795b7b38bd7e6142cd1b88211dade +0 -0
  101. data/spec/dummy/tmp/cache/assets/D6D/530/sprockets%2F8d52dee91bff01a8a2306d8a7c9152a9 +0 -0
  102. data/spec/dummy/tmp/cache/assets/D6D/DA0/sprockets%2Fac936bf40b42227a2bf9d474ae9ec149 +0 -0
  103. data/spec/dummy/tmp/cache/assets/D77/B30/sprockets%2F946cf2f17c7eb41037f9ee08ad67ec40 +0 -0
  104. data/spec/dummy/tmp/cache/assets/D78/2F0/sprockets%2F3c61f8915b8f717b1de788e6ecad122c +0 -0
  105. data/spec/dummy/tmp/cache/assets/D80/390/sprockets%2Fe44158f578d9ffade083a07f54eab729 +0 -0
  106. data/spec/dummy/tmp/cache/assets/D8C/520/sprockets%2F221cd58a042baac534d27e4cfedc1188 +0 -0
  107. data/spec/dummy/tmp/cache/assets/D93/BD0/sprockets%2Ff5e1b60201e08e3ddf8d3de5211f3d5e +0 -0
  108. data/spec/dummy/tmp/cache/assets/D9B/C20/sprockets%2F0e01606ddd95e451bc7d39ce0eeb664d +0 -0
  109. data/spec/dummy/tmp/cache/assets/DA0/330/sprockets%2Fcbbb4de706387d50f48a72ee6c9c1b80 +0 -0
  110. data/spec/dummy/tmp/cache/assets/DA5/0A0/sprockets%2F7a4b5928cec69ab65afff309a04d6b47 +0 -0
  111. data/spec/dummy/tmp/cache/assets/DAE/6C0/sprockets%2F77c7a8676aeefa73156c55dfcf51cc46 +0 -0
  112. data/spec/dummy/tmp/cache/assets/DAF/7C0/sprockets%2F8942514d59e7bffbfb33cde6fa9735c2 +0 -0
  113. data/spec/dummy/tmp/cache/assets/DB3/5D0/sprockets%2Fce1d4d75832c9bdeafd869f6f7b61725 +0 -0
  114. data/spec/dummy/tmp/cache/assets/DB3/D70/sprockets%2Fcc2f5e1f6eeb99c33881848cb1cde758 +0 -0
  115. data/spec/dummy/tmp/cache/assets/DB5/040/sprockets%2F9a9da5df88713663b9fbc945facca891 +0 -0
  116. data/spec/dummy/tmp/cache/assets/DC3/230/sprockets%2Fdf52e72eb73be91eccc60182191aed0b +0 -0
  117. data/spec/dummy/tmp/cache/assets/DC7/A10/sprockets%2F84a8af0fcbf401864e1ae5bf092cba94 +0 -0
  118. data/spec/dummy/tmp/cache/assets/DCD/EB0/sprockets%2F4f77f509126ecbced7ea2a5ab290c8d4 +0 -0
  119. data/spec/dummy/tmp/cache/assets/DD8/C10/sprockets%2Ffb91282efc9f16ebaf7e98e312ce0b73 +0 -0
  120. data/spec/dummy/tmp/cache/assets/DDB/EF0/sprockets%2Fe790bb18b64df8aa0a9fe94642a9edd8 +0 -0
  121. data/spec/dummy/tmp/cache/assets/DDD/A60/sprockets%2Fff948b6ffe44a3cc3d2d109a39f548fd +0 -0
  122. data/spec/dummy/tmp/cache/assets/DEB/110/sprockets%2F2dbdab0ce5babca645cdb5780004f875 +0 -0
  123. data/spec/dummy/tmp/cache/assets/DF6/0E0/sprockets%2F85b10db6e1afe643aba6d396abdd77f0 +0 -0
  124. data/spec/dummy/tmp/cache/assets/DF7/E10/sprockets%2F25e4253aba9a9adcefb72552fb1ff0c8 +0 -0
  125. data/spec/dummy/tmp/cache/assets/DF9/AD0/sprockets%2Fc700afd7cee3fe9d7ff8352b213b2c4a +0 -0
  126. data/spec/dummy/tmp/cache/assets/DFC/C20/sprockets%2Fd9178ad7e3b401c9fceafd64ea2b50d6 +0 -0
  127. data/spec/dummy/tmp/cache/assets/DFC/C30/sprockets%2Fb50a07cb30b0bd0eec8e98e5de79d65d +0 -0
  128. data/spec/dummy/tmp/cache/assets/E02/6E0/sprockets%2F63d6a5cdb8cefa64ef76b5c6e0fd3720 +0 -0
  129. data/spec/dummy/tmp/cache/assets/E08/BB0/sprockets%2Fefac99af1af28543aef6fb607faa4973 +0 -0
  130. data/spec/dummy/tmp/cache/assets/E0D/070/sprockets%2F0e7ef9a5978dcc6b1abce678ef836c0a +0 -0
  131. data/spec/dummy/tmp/cache/assets/E17/EF0/sprockets%2Fa291ad64a26afd055dfadabbdf03f154 +0 -0
  132. data/spec/dummy/tmp/cache/assets/E2F/790/sprockets%2F7fac280deaa7ef20a77d5c9b5b9cfc34 +0 -0
  133. data/spec/dummy/tmp/cache/assets/E37/9B0/sprockets%2F4defba98cf7befff81450e2b24e90b6d +0 -0
  134. data/spec/dummy/tmp/cache/assets/E41/250/sprockets%2F97cf8fe3d7ffaff076f655aefb36da03 +0 -0
  135. data/spec/dummy/tmp/cache/assets/E58/840/sprockets%2Fab7a15f76acfee8c320dd3cfc2a8c6d5 +0 -0
  136. data/spec/dummy/tmp/cache/assets/E64/1E0/sprockets%2F81ab4c863fbbdec8dd66afc97ebf034d +0 -0
  137. data/spec/dummy/tmp/cache/assets/E6E/260/sprockets%2Fd9f8ab8b91ef582cc6c99a3ba0dedfe6 +0 -0
  138. data/spec/dummy/tmp/cache/assets/E89/4C0/sprockets%2F68b2eedb3cde6fc01d50fead7caf8a18 +0 -0
  139. data/spec/dummy/tmp/cache/assets/F79/360/sprockets%2F0ce035fefee5ebdabc8efabfbdbd6ee4 +0 -0
  140. data/spec/javascripts/teabag/mocha/reporters/html_mspec.coffee +1 -1
  141. data/vendor/assets/javascripts/{mocha-1.8.1.MIT.LICENSE → mocha-1.9.1.MIT.LICENSE} +0 -0
  142. data/vendor/assets/javascripts/{mocha-1.8.1.js → mocha-1.9.1.js} +79 -81
  143. data/vendor/assets/javascripts/{qunit-1.10.0.MIT.LICENSE → qunit-1.11.0.MIT.LICENSE} +0 -0
  144. data/vendor/assets/javascripts/{qunit-1.10.0.js → qunit-1.11.0.js} +319 -144
  145. data/vendor/assets/javascripts/support/chai.js +721 -279
  146. data/vendor/assets/javascripts/support/jasmine-jquery.js +28 -2
  147. data/vendor/assets/javascripts/support/sinon.js +581 -435
  148. metadata +26 -8
@@ -1,5 +1,31 @@
1
- // https://github.com/velesin/jasmine-jquery/commit/f65c78fb83775bd1f0ce3dc13fe9a82dc2b4e889
2
-
1
+ /*!
2
+ Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
3
+
4
+ Version 1.5.0
5
+
6
+ https://github.com/velesin/jasmine-jquery
7
+
8
+ Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining
11
+ a copy of this software and associated documentation files (the
12
+ "Software"), to deal in the Software without restriction, including
13
+ without limitation the rights to use, copy, modify, merge, publish,
14
+ distribute, sublicense, and/or sell copies of the Software, and to
15
+ permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be
19
+ included in all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
+ */
3
29
  var readFixtures = function() {
4
30
  return jasmine.getFixtures().proxyCallTo_('read', arguments)
5
31
  }
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Sinon.JS 1.5.2, 2012/11/27
2
+ * Sinon.JS 1.7.1, 2013/05/07
3
3
  *
4
4
  * @author Christian Johansen (christian@cjohansen.no)
5
5
  * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
6
6
  *
7
7
  * (The BSD License)
8
8
  *
9
- * Copyright (c) 2010-2012, Christian Johansen, christian@cjohansen.no
9
+ * Copyright (c) 2010-2013, Christian Johansen, christian@cjohansen.no
10
10
  * All rights reserved.
11
11
  *
12
12
  * Redistribution and use in source and binary forms, with or without modification,
@@ -33,9 +33,7 @@
33
33
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
34
  */
35
35
 
36
- var sinon = (function () {
37
- "use strict";
38
-
36
+ this.sinon = (function () {
39
37
  var buster = (function (setTimeout, B) {
40
38
  var isNode = typeof require == "function" && typeof module == "object";
41
39
  var div = typeof document != "undefined" && document.createElement("div");
@@ -463,7 +461,7 @@ var sinon = (function () {
463
461
  * @author Christian Johansen (christian@cjohansen.no)
464
462
  * @license BSD
465
463
  *
466
- * Copyright (c) 2010-2011 Christian Johansen
464
+ * Copyright (c) 2010-2013 Christian Johansen
467
465
  */
468
466
 
469
467
  var sinon = (function (buster) {
@@ -505,6 +503,10 @@ var sinon = (function () {
505
503
  }
506
504
  }
507
505
 
506
+ function isRestorable (obj) {
507
+ return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon;
508
+ }
509
+
508
510
  var sinon = {
509
511
  wrapMethod: function wrapMethod(object, property, method) {
510
512
  if (!object) {
@@ -631,11 +633,7 @@ var sinon = (function () {
631
633
  bLength += 1;
632
634
  }
633
635
 
634
- if (aLength != bLength) {
635
- return false;
636
- }
637
-
638
- return true;
636
+ return aLength == bLength;
639
637
  },
640
638
 
641
639
  functionName: function functionName(func) {
@@ -706,7 +704,7 @@ var sinon = (function () {
706
704
 
707
705
  calledInOrder: function (spies) {
708
706
  for (var i = 1, l = spies.length; i < l; i++) {
709
- if (!spies[i - 1].calledBefore(spies[i])) {
707
+ if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
710
708
  return false;
711
709
  }
712
710
  }
@@ -748,6 +746,26 @@ var sinon = (function () {
748
746
  }
749
747
  var string = Object.prototype.toString.call(value);
750
748
  return string.substring(8, string.length - 1).toLowerCase();
749
+ },
750
+
751
+ createStubInstance: function (constructor) {
752
+ if (typeof constructor !== "function") {
753
+ throw new TypeError("The constructor should be a function.");
754
+ }
755
+ return sinon.stub(sinon.create(constructor.prototype));
756
+ },
757
+
758
+ restore: function (object) {
759
+ if (object !== null && typeof object === "object") {
760
+ for (var prop in object) {
761
+ if (isRestorable(object[prop])) {
762
+ object[prop].restore();
763
+ }
764
+ }
765
+ }
766
+ else if (isRestorable(object)) {
767
+ object.restore();
768
+ }
751
769
  }
752
770
  };
753
771
 
@@ -759,6 +777,7 @@ var sinon = (function () {
759
777
  } catch (e) {}
760
778
  module.exports = sinon;
761
779
  module.exports.spy = require("./sinon/spy");
780
+ module.exports.spyCall = require("./sinon/call");
762
781
  module.exports.stub = require("./sinon/stub");
763
782
  module.exports.mock = require("./sinon/mock");
764
783
  module.exports.collection = require("./sinon/collection");
@@ -1037,21 +1056,18 @@ var sinon = (function () {
1037
1056
  /*jslint eqeqeq: false, onevar: false, plusplus: false*/
1038
1057
  /*global module, require, sinon*/
1039
1058
  /**
1040
- * Spy functions
1059
+ * Spy calls
1041
1060
  *
1042
1061
  * @author Christian Johansen (christian@cjohansen.no)
1062
+ * @author Maximilian Antoni (mail@maxantoni.de)
1043
1063
  * @license BSD
1044
1064
  *
1045
- * Copyright (c) 2010-2011 Christian Johansen
1065
+ * Copyright (c) 2010-2013 Christian Johansen
1066
+ * Copyright (c) 2013 Maximilian Antoni
1046
1067
  */
1047
1068
 
1048
1069
  (function (sinon) {
1049
1070
  var commonJSModule = typeof module == "object" && typeof require == "function";
1050
- var spyCall;
1051
- var callId = 0;
1052
- var push = [].push;
1053
- var slice = Array.prototype.slice;
1054
-
1055
1071
  if (!sinon && commonJSModule) {
1056
1072
  sinon = require("../sinon");
1057
1073
  }
@@ -1060,505 +1076,565 @@ var sinon = (function () {
1060
1076
  return;
1061
1077
  }
1062
1078
 
1063
- function spy(object, property) {
1064
- if (!property && typeof object == "function") {
1065
- return spy.create(object);
1066
- }
1067
-
1068
- if (!object && !property) {
1069
- return spy.create(function () {});
1079
+ function throwYieldError(proxy, text, args) {
1080
+ var msg = sinon.functionName(proxy) + text;
1081
+ if (args.length) {
1082
+ msg += " Received [" + slice.call(args).join(", ") + "]";
1070
1083
  }
1071
-
1072
- var method = object[property];
1073
- return sinon.wrapMethod(object, property, spy.create(method));
1084
+ throw new Error(msg);
1074
1085
  }
1075
1086
 
1076
- sinon.extend(spy, (function () {
1087
+ var slice = Array.prototype.slice;
1077
1088
 
1078
- function delegateToCalls(api, method, matchAny, actual, notCalled) {
1079
- api[method] = function () {
1080
- if (!this.called) {
1081
- if (notCalled) {
1082
- return notCalled.apply(this, arguments);
1083
- }
1089
+ var callProto = {
1090
+ calledOn: function calledOn(thisValue) {
1091
+ if (sinon.match && sinon.match.isMatcher(thisValue)) {
1092
+ return thisValue.test(this.thisValue);
1093
+ }
1094
+ return this.thisValue === thisValue;
1095
+ },
1096
+
1097
+ calledWith: function calledWith() {
1098
+ for (var i = 0, l = arguments.length; i < l; i += 1) {
1099
+ if (!sinon.deepEqual(arguments[i], this.args[i])) {
1084
1100
  return false;
1085
1101
  }
1102
+ }
1103
+
1104
+ return true;
1105
+ },
1086
1106
 
1087
- var currentCall;
1088
- var matches = 0;
1107
+ calledWithMatch: function calledWithMatch() {
1108
+ for (var i = 0, l = arguments.length; i < l; i += 1) {
1109
+ var actual = this.args[i];
1110
+ var expectation = arguments[i];
1111
+ if (!sinon.match || !sinon.match(expectation).test(actual)) {
1112
+ return false;
1113
+ }
1114
+ }
1115
+ return true;
1116
+ },
1089
1117
 
1090
- for (var i = 0, l = this.callCount; i < l; i += 1) {
1091
- currentCall = this.getCall(i);
1118
+ calledWithExactly: function calledWithExactly() {
1119
+ return arguments.length == this.args.length &&
1120
+ this.calledWith.apply(this, arguments);
1121
+ },
1092
1122
 
1093
- if (currentCall[actual || method].apply(currentCall, arguments)) {
1094
- matches += 1;
1123
+ notCalledWith: function notCalledWith() {
1124
+ return !this.calledWith.apply(this, arguments);
1125
+ },
1095
1126
 
1096
- if (matchAny) {
1097
- return true;
1098
- }
1099
- }
1100
- }
1127
+ notCalledWithMatch: function notCalledWithMatch() {
1128
+ return !this.calledWithMatch.apply(this, arguments);
1129
+ },
1101
1130
 
1102
- return matches === this.callCount;
1103
- };
1104
- }
1131
+ returned: function returned(value) {
1132
+ return sinon.deepEqual(value, this.returnValue);
1133
+ },
1105
1134
 
1106
- function matchingFake(fakes, args, strict) {
1107
- if (!fakes) {
1108
- return;
1135
+ threw: function threw(error) {
1136
+ if (typeof error === "undefined" || !this.exception) {
1137
+ return !!this.exception;
1109
1138
  }
1110
1139
 
1111
- var alen = args.length;
1140
+ return this.exception === error || this.exception.name === error;
1141
+ },
1112
1142
 
1113
- for (var i = 0, l = fakes.length; i < l; i++) {
1114
- if (fakes[i].matches(args, strict)) {
1115
- return fakes[i];
1116
- }
1117
- }
1118
- }
1143
+ calledWithNew: function calledWithNew(thisValue) {
1144
+ return this.thisValue instanceof this.proxy;
1145
+ },
1119
1146
 
1120
- function incrementCallCount() {
1121
- this.called = true;
1122
- this.callCount += 1;
1123
- this.notCalled = false;
1124
- this.calledOnce = this.callCount == 1;
1125
- this.calledTwice = this.callCount == 2;
1126
- this.calledThrice = this.callCount == 3;
1127
- }
1147
+ calledBefore: function (other) {
1148
+ return this.callId < other.callId;
1149
+ },
1128
1150
 
1129
- function createCallProperties() {
1130
- this.firstCall = this.getCall(0);
1131
- this.secondCall = this.getCall(1);
1132
- this.thirdCall = this.getCall(2);
1133
- this.lastCall = this.getCall(this.callCount - 1);
1134
- }
1151
+ calledAfter: function (other) {
1152
+ return this.callId > other.callId;
1153
+ },
1135
1154
 
1136
- var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
1137
- function createProxy(func) {
1138
- // Retain the function length:
1139
- var p;
1140
- if (func.length) {
1141
- eval("p = (function proxy(" + vars.substring(0, func.length * 2 - 1) +
1142
- ") { return p.invoke(func, this, slice.call(arguments)); });");
1143
- }
1144
- else {
1145
- p = function proxy() {
1146
- return p.invoke(func, this, slice.call(arguments));
1147
- };
1148
- }
1149
- return p;
1150
- }
1155
+ callArg: function (pos) {
1156
+ this.args[pos]();
1157
+ },
1151
1158
 
1152
- var uuid = 0;
1153
-
1154
- // Public API
1155
- var spyApi = {
1156
- reset: function () {
1157
- this.called = false;
1158
- this.notCalled = true;
1159
- this.calledOnce = false;
1160
- this.calledTwice = false;
1161
- this.calledThrice = false;
1162
- this.callCount = 0;
1163
- this.firstCall = null;
1164
- this.secondCall = null;
1165
- this.thirdCall = null;
1166
- this.lastCall = null;
1167
- this.args = [];
1168
- this.returnValues = [];
1169
- this.thisValues = [];
1170
- this.exceptions = [];
1171
- this.callIds = [];
1172
- if (this.fakes) {
1173
- for (var i = 0; i < this.fakes.length; i++) {
1174
- this.fakes[i].reset();
1175
- }
1176
- }
1177
- },
1159
+ callArgOn: function (pos, thisValue) {
1160
+ this.args[pos].apply(thisValue);
1161
+ },
1178
1162
 
1179
- create: function create(func) {
1180
- var name;
1163
+ callArgWith: function (pos) {
1164
+ this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
1165
+ },
1181
1166
 
1182
- if (typeof func != "function") {
1183
- func = function () {};
1184
- } else {
1185
- name = sinon.functionName(func);
1167
+ callArgOnWith: function (pos, thisValue) {
1168
+ var args = slice.call(arguments, 2);
1169
+ this.args[pos].apply(thisValue, args);
1170
+ },
1171
+
1172
+ "yield": function () {
1173
+ this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
1174
+ },
1175
+
1176
+ yieldOn: function (thisValue) {
1177
+ var args = this.args;
1178
+ for (var i = 0, l = args.length; i < l; ++i) {
1179
+ if (typeof args[i] === "function") {
1180
+ args[i].apply(thisValue, slice.call(arguments, 1));
1181
+ return;
1186
1182
  }
1183
+ }
1184
+ throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
1185
+ },
1187
1186
 
1188
- var proxy = createProxy(func);
1187
+ yieldTo: function (prop) {
1188
+ this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
1189
+ },
1189
1190
 
1190
- sinon.extend(proxy, spy);
1191
- delete proxy.create;
1192
- sinon.extend(proxy, func);
1191
+ yieldToOn: function (prop, thisValue) {
1192
+ var args = this.args;
1193
+ for (var i = 0, l = args.length; i < l; ++i) {
1194
+ if (args[i] && typeof args[i][prop] === "function") {
1195
+ args[i][prop].apply(thisValue, slice.call(arguments, 2));
1196
+ return;
1197
+ }
1198
+ }
1199
+ throwYieldError(this.proxy, " cannot yield to '" + prop +
1200
+ "' since no callback was passed.", args);
1201
+ },
1193
1202
 
1194
- proxy.reset();
1195
- proxy.prototype = func.prototype;
1196
- proxy.displayName = name || "spy";
1197
- proxy.toString = sinon.functionToString;
1198
- proxy._create = sinon.spy.create;
1199
- proxy.id = "spy#" + uuid++;
1203
+ toString: function () {
1204
+ var callStr = this.proxy.toString() + "(";
1205
+ var args = [];
1200
1206
 
1201
- return proxy;
1202
- },
1207
+ for (var i = 0, l = this.args.length; i < l; ++i) {
1208
+ args.push(sinon.format(this.args[i]));
1209
+ }
1203
1210
 
1204
- invoke: function invoke(func, thisValue, args) {
1205
- var matching = matchingFake(this.fakes, args);
1206
- var exception, returnValue;
1211
+ callStr = callStr + args.join(", ") + ")";
1207
1212
 
1208
- incrementCallCount.call(this);
1209
- push.call(this.thisValues, thisValue);
1210
- push.call(this.args, args);
1211
- push.call(this.callIds, callId++);
1213
+ if (typeof this.returnValue != "undefined") {
1214
+ callStr += " => " + sinon.format(this.returnValue);
1215
+ }
1212
1216
 
1213
- try {
1214
- if (matching) {
1215
- returnValue = matching.invoke(func, thisValue, args);
1216
- } else {
1217
- returnValue = (this.func || func).apply(thisValue, args);
1218
- }
1219
- } catch (e) {
1220
- push.call(this.returnValues, undefined);
1221
- exception = e;
1222
- throw e;
1223
- } finally {
1224
- push.call(this.exceptions, exception);
1217
+ if (this.exception) {
1218
+ callStr += " !" + this.exception.name;
1219
+
1220
+ if (this.exception.message) {
1221
+ callStr += "(" + this.exception.message + ")";
1225
1222
  }
1223
+ }
1226
1224
 
1227
- push.call(this.returnValues, returnValue);
1225
+ return callStr;
1226
+ }
1227
+ };
1228
1228
 
1229
- createCallProperties.call(this);
1229
+ callProto.invokeCallback = callProto.yield;
1230
1230
 
1231
- return returnValue;
1232
- },
1231
+ function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
1232
+ if (typeof id !== "number") {
1233
+ throw new TypeError("Call id is not a number");
1234
+ }
1235
+ var proxyCall = sinon.create(callProto);
1236
+ proxyCall.proxy = spy;
1237
+ proxyCall.thisValue = thisValue;
1238
+ proxyCall.args = args;
1239
+ proxyCall.returnValue = returnValue;
1240
+ proxyCall.exception = exception;
1241
+ proxyCall.callId = id;
1242
+
1243
+ return proxyCall;
1244
+ };
1245
+ createSpyCall.toString = callProto.toString; // used by mocks
1233
1246
 
1234
- getCall: function getCall(i) {
1235
- if (i < 0 || i >= this.callCount) {
1236
- return null;
1237
- }
1247
+ if (commonJSModule) {
1248
+ module.exports = createSpyCall;
1249
+ } else {
1250
+ sinon.spyCall = createSpyCall;
1251
+ }
1252
+ }(typeof sinon == "object" && sinon || null));
1238
1253
 
1239
- return spyCall.create(this, this.thisValues[i], this.args[i],
1240
- this.returnValues[i], this.exceptions[i],
1241
- this.callIds[i]);
1242
- },
1243
1254
 
1244
- calledBefore: function calledBefore(spyFn) {
1245
- if (!this.called) {
1246
- return false;
1247
- }
1255
+ /**
1256
+ * @depend ../sinon.js
1257
+ * @depend call.js
1258
+ */
1259
+ /*jslint eqeqeq: false, onevar: false, plusplus: false*/
1260
+ /*global module, require, sinon*/
1261
+ /**
1262
+ * Spy functions
1263
+ *
1264
+ * @author Christian Johansen (christian@cjohansen.no)
1265
+ * @license BSD
1266
+ *
1267
+ * Copyright (c) 2010-2013 Christian Johansen
1268
+ */
1248
1269
 
1249
- if (!spyFn.called) {
1250
- return true;
1251
- }
1270
+ (function (sinon) {
1271
+ var commonJSModule = typeof module == "object" && typeof require == "function";
1272
+ var push = Array.prototype.push;
1273
+ var slice = Array.prototype.slice;
1274
+ var callId = 0;
1252
1275
 
1253
- return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
1254
- },
1276
+ if (!sinon && commonJSModule) {
1277
+ sinon = require("../sinon");
1278
+ }
1255
1279
 
1256
- calledAfter: function calledAfter(spyFn) {
1257
- if (!this.called || !spyFn.called) {
1258
- return false;
1259
- }
1280
+ if (!sinon) {
1281
+ return;
1282
+ }
1260
1283
 
1261
- return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
1262
- },
1284
+ function spy(object, property) {
1285
+ if (!property && typeof object == "function") {
1286
+ return spy.create(object);
1287
+ }
1263
1288
 
1264
- withArgs: function () {
1265
- var args = slice.call(arguments);
1289
+ if (!object && !property) {
1290
+ return spy.create(function () { });
1291
+ }
1266
1292
 
1267
- if (this.fakes) {
1268
- var match = matchingFake(this.fakes, args, true);
1293
+ var method = object[property];
1294
+ return sinon.wrapMethod(object, property, spy.create(method));
1295
+ }
1269
1296
 
1270
- if (match) {
1271
- return match;
1272
- }
1273
- } else {
1274
- this.fakes = [];
1275
- }
1297
+ function matchingFake(fakes, args, strict) {
1298
+ if (!fakes) {
1299
+ return;
1300
+ }
1276
1301
 
1277
- var original = this;
1278
- var fake = this._create();
1279
- fake.matchingAguments = args;
1280
- push.call(this.fakes, fake);
1302
+ var alen = args.length;
1281
1303
 
1282
- fake.withArgs = function () {
1283
- return original.withArgs.apply(original, arguments);
1284
- };
1304
+ for (var i = 0, l = fakes.length; i < l; i++) {
1305
+ if (fakes[i].matches(args, strict)) {
1306
+ return fakes[i];
1307
+ }
1308
+ }
1309
+ }
1285
1310
 
1286
- for (var i = 0; i < this.args.length; i++) {
1287
- if (fake.matches(this.args[i])) {
1288
- incrementCallCount.call(fake);
1289
- push.call(fake.thisValues, this.thisValues[i]);
1290
- push.call(fake.args, this.args[i]);
1291
- push.call(fake.returnValues, this.returnValues[i]);
1292
- push.call(fake.exceptions, this.exceptions[i]);
1293
- push.call(fake.callIds, this.callIds[i]);
1294
- }
1295
- }
1296
- createCallProperties.call(fake);
1311
+ function incrementCallCount() {
1312
+ this.called = true;
1313
+ this.callCount += 1;
1314
+ this.notCalled = false;
1315
+ this.calledOnce = this.callCount == 1;
1316
+ this.calledTwice = this.callCount == 2;
1317
+ this.calledThrice = this.callCount == 3;
1318
+ }
1297
1319
 
1298
- return fake;
1299
- },
1320
+ function createCallProperties() {
1321
+ this.firstCall = this.getCall(0);
1322
+ this.secondCall = this.getCall(1);
1323
+ this.thirdCall = this.getCall(2);
1324
+ this.lastCall = this.getCall(this.callCount - 1);
1325
+ }
1326
+
1327
+ var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
1328
+ function createProxy(func) {
1329
+ // Retain the function length:
1330
+ var p;
1331
+ if (func.length) {
1332
+ eval("p = (function proxy(" + vars.substring(0, func.length * 2 - 1) +
1333
+ ") { return p.invoke(func, this, slice.call(arguments)); });");
1334
+ }
1335
+ else {
1336
+ p = function proxy() {
1337
+ return p.invoke(func, this, slice.call(arguments));
1338
+ };
1339
+ }
1340
+ return p;
1341
+ }
1300
1342
 
1301
- matches: function (args, strict) {
1302
- var margs = this.matchingAguments;
1343
+ var uuid = 0;
1303
1344
 
1304
- if (margs.length <= args.length &&
1305
- sinon.deepEqual(margs, args.slice(0, margs.length))) {
1306
- return !strict || margs.length == args.length;
1345
+ // Public API
1346
+ var spyApi = {
1347
+ reset: function () {
1348
+ this.called = false;
1349
+ this.notCalled = true;
1350
+ this.calledOnce = false;
1351
+ this.calledTwice = false;
1352
+ this.calledThrice = false;
1353
+ this.callCount = 0;
1354
+ this.firstCall = null;
1355
+ this.secondCall = null;
1356
+ this.thirdCall = null;
1357
+ this.lastCall = null;
1358
+ this.args = [];
1359
+ this.returnValues = [];
1360
+ this.thisValues = [];
1361
+ this.exceptions = [];
1362
+ this.callIds = [];
1363
+ if (this.fakes) {
1364
+ for (var i = 0; i < this.fakes.length; i++) {
1365
+ this.fakes[i].reset();
1307
1366
  }
1308
- },
1367
+ }
1368
+ },
1309
1369
 
1310
- printf: function (format) {
1311
- var spy = this;
1312
- var args = slice.call(arguments, 1);
1313
- var formatter;
1370
+ create: function create(func) {
1371
+ var name;
1314
1372
 
1315
- return (format || "").replace(/%(.)/g, function (match, specifyer) {
1316
- formatter = spyApi.formatters[specifyer];
1373
+ if (typeof func != "function") {
1374
+ func = function () { };
1375
+ } else {
1376
+ name = sinon.functionName(func);
1377
+ }
1317
1378
 
1318
- if (typeof formatter == "function") {
1319
- return formatter.call(null, spy, args);
1320
- } else if (!isNaN(parseInt(specifyer), 10)) {
1321
- return sinon.format(args[specifyer - 1]);
1322
- }
1379
+ var proxy = createProxy(func);
1323
1380
 
1324
- return "%" + specifyer;
1325
- });
1326
- }
1327
- };
1381
+ sinon.extend(proxy, spy);
1382
+ delete proxy.create;
1383
+ sinon.extend(proxy, func);
1328
1384
 
1329
- delegateToCalls(spyApi, "calledOn", true);
1330
- delegateToCalls(spyApi, "alwaysCalledOn", false, "calledOn");
1331
- delegateToCalls(spyApi, "calledWith", true);
1332
- delegateToCalls(spyApi, "calledWithMatch", true);
1333
- delegateToCalls(spyApi, "alwaysCalledWith", false, "calledWith");
1334
- delegateToCalls(spyApi, "alwaysCalledWithMatch", false, "calledWithMatch");
1335
- delegateToCalls(spyApi, "calledWithExactly", true);
1336
- delegateToCalls(spyApi, "alwaysCalledWithExactly", false, "calledWithExactly");
1337
- delegateToCalls(spyApi, "neverCalledWith", false, "notCalledWith",
1338
- function () { return true; });
1339
- delegateToCalls(spyApi, "neverCalledWithMatch", false, "notCalledWithMatch",
1340
- function () { return true; });
1341
- delegateToCalls(spyApi, "threw", true);
1342
- delegateToCalls(spyApi, "alwaysThrew", false, "threw");
1343
- delegateToCalls(spyApi, "returned", true);
1344
- delegateToCalls(spyApi, "alwaysReturned", false, "returned");
1345
- delegateToCalls(spyApi, "calledWithNew", true);
1346
- delegateToCalls(spyApi, "alwaysCalledWithNew", false, "calledWithNew");
1347
- delegateToCalls(spyApi, "callArg", false, "callArgWith", function () {
1348
- throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
1349
- });
1350
- spyApi.callArgWith = spyApi.callArg;
1351
- delegateToCalls(spyApi, "yield", false, "yield", function () {
1352
- throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
1353
- });
1354
- // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
1355
- spyApi.invokeCallback = spyApi.yield;
1356
- delegateToCalls(spyApi, "yieldTo", false, "yieldTo", function (property) {
1357
- throw new Error(this.toString() + " cannot yield to '" + property +
1358
- "' since it was not yet invoked.");
1359
- });
1385
+ proxy.reset();
1386
+ proxy.prototype = func.prototype;
1387
+ proxy.displayName = name || "spy";
1388
+ proxy.toString = sinon.functionToString;
1389
+ proxy._create = sinon.spy.create;
1390
+ proxy.id = "spy#" + uuid++;
1360
1391
 
1361
- spyApi.formatters = {
1362
- "c": function (spy) {
1363
- return sinon.timesInWords(spy.callCount);
1364
- },
1392
+ return proxy;
1393
+ },
1365
1394
 
1366
- "n": function (spy) {
1367
- return spy.toString();
1368
- },
1395
+ invoke: function invoke(func, thisValue, args) {
1396
+ var matching = matchingFake(this.fakes, args);
1397
+ var exception, returnValue;
1369
1398
 
1370
- "C": function (spy) {
1371
- var calls = [];
1399
+ incrementCallCount.call(this);
1400
+ push.call(this.thisValues, thisValue);
1401
+ push.call(this.args, args);
1402
+ push.call(this.callIds, callId++);
1372
1403
 
1373
- for (var i = 0, l = spy.callCount; i < l; ++i) {
1374
- push.call(calls, " " + spy.getCall(i).toString());
1404
+ try {
1405
+ if (matching) {
1406
+ returnValue = matching.invoke(func, thisValue, args);
1407
+ } else {
1408
+ returnValue = (this.func || func).apply(thisValue, args);
1375
1409
  }
1410
+ } catch (e) {
1411
+ push.call(this.returnValues, undefined);
1412
+ exception = e;
1413
+ throw e;
1414
+ } finally {
1415
+ push.call(this.exceptions, exception);
1416
+ }
1376
1417
 
1377
- return calls.length > 0 ? "\n" + calls.join("\n") : "";
1378
- },
1379
-
1380
- "t": function (spy) {
1381
- var objects = [];
1418
+ push.call(this.returnValues, returnValue);
1382
1419
 
1383
- for (var i = 0, l = spy.callCount; i < l; ++i) {
1384
- push.call(objects, sinon.format(spy.thisValues[i]));
1385
- }
1420
+ createCallProperties.call(this);
1386
1421
 
1387
- return objects.join(", ");
1388
- },
1422
+ return returnValue;
1423
+ },
1389
1424
 
1390
- "*": function (spy, args) {
1391
- var formatted = [];
1425
+ getCall: function getCall(i) {
1426
+ if (i < 0 || i >= this.callCount) {
1427
+ return null;
1428
+ }
1392
1429
 
1393
- for (var i = 0, l = args.length; i < l; ++i) {
1394
- push.call(formatted, sinon.format(args[i]));
1395
- }
1430
+ return sinon.spyCall(this, this.thisValues[i], this.args[i],
1431
+ this.returnValues[i], this.exceptions[i],
1432
+ this.callIds[i]);
1433
+ },
1396
1434
 
1397
- return formatted.join(", ");
1435
+ calledBefore: function calledBefore(spyFn) {
1436
+ if (!this.called) {
1437
+ return false;
1398
1438
  }
1399
- };
1400
1439
 
1401
- return spyApi;
1402
- }()));
1440
+ if (!spyFn.called) {
1441
+ return true;
1442
+ }
1403
1443
 
1404
- spyCall = (function () {
1444
+ return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
1445
+ },
1405
1446
 
1406
- function throwYieldError(proxy, text, args) {
1407
- var msg = sinon.functionName(proxy) + text;
1408
- if (args.length) {
1409
- msg += " Received [" + slice.call(args).join(", ") + "]";
1447
+ calledAfter: function calledAfter(spyFn) {
1448
+ if (!this.called || !spyFn.called) {
1449
+ return false;
1410
1450
  }
1411
- throw new Error(msg);
1412
- }
1413
1451
 
1414
- var callApi = {
1415
- create: function create(spy, thisValue, args, returnValue, exception, id) {
1416
- var proxyCall = sinon.create(spyCall);
1417
- delete proxyCall.create;
1418
- proxyCall.proxy = spy;
1419
- proxyCall.thisValue = thisValue;
1420
- proxyCall.args = args;
1421
- proxyCall.returnValue = returnValue;
1422
- proxyCall.exception = exception;
1423
- proxyCall.callId = typeof id == "number" && id || callId++;
1424
-
1425
- return proxyCall;
1426
- },
1452
+ return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
1453
+ },
1427
1454
 
1428
- calledOn: function calledOn(thisValue) {
1429
- if (sinon.match && sinon.match.isMatcher(thisValue)) {
1430
- return thisValue.test(this.thisValue);
1431
- }
1432
- return this.thisValue === thisValue;
1433
- },
1455
+ withArgs: function () {
1456
+ var args = slice.call(arguments);
1434
1457
 
1435
- calledWith: function calledWith() {
1436
- for (var i = 0, l = arguments.length; i < l; i += 1) {
1437
- if (!sinon.deepEqual(arguments[i], this.args[i])) {
1438
- return false;
1439
- }
1458
+ if (this.fakes) {
1459
+ var match = matchingFake(this.fakes, args, true);
1460
+
1461
+ if (match) {
1462
+ return match;
1440
1463
  }
1464
+ } else {
1465
+ this.fakes = [];
1466
+ }
1441
1467
 
1442
- return true;
1443
- },
1468
+ var original = this;
1469
+ var fake = this._create();
1470
+ fake.matchingAguments = args;
1471
+ push.call(this.fakes, fake);
1444
1472
 
1445
- calledWithMatch: function calledWithMatch() {
1446
- for (var i = 0, l = arguments.length; i < l; i += 1) {
1447
- var actual = this.args[i];
1448
- var expectation = arguments[i];
1449
- if (!sinon.match || !sinon.match(expectation).test(actual)) {
1450
- return false;
1451
- }
1473
+ fake.withArgs = function () {
1474
+ return original.withArgs.apply(original, arguments);
1475
+ };
1476
+
1477
+ for (var i = 0; i < this.args.length; i++) {
1478
+ if (fake.matches(this.args[i])) {
1479
+ incrementCallCount.call(fake);
1480
+ push.call(fake.thisValues, this.thisValues[i]);
1481
+ push.call(fake.args, this.args[i]);
1482
+ push.call(fake.returnValues, this.returnValues[i]);
1483
+ push.call(fake.exceptions, this.exceptions[i]);
1484
+ push.call(fake.callIds, this.callIds[i]);
1452
1485
  }
1453
- return true;
1454
- },
1486
+ }
1487
+ createCallProperties.call(fake);
1455
1488
 
1456
- calledWithExactly: function calledWithExactly() {
1457
- return arguments.length == this.args.length &&
1458
- this.calledWith.apply(this, arguments);
1459
- },
1489
+ return fake;
1490
+ },
1460
1491
 
1461
- notCalledWith: function notCalledWith() {
1462
- return !this.calledWith.apply(this, arguments);
1463
- },
1492
+ matches: function (args, strict) {
1493
+ var margs = this.matchingAguments;
1464
1494
 
1465
- notCalledWithMatch: function notCalledWithMatch() {
1466
- return !this.calledWithMatch.apply(this, arguments);
1467
- },
1495
+ if (margs.length <= args.length &&
1496
+ sinon.deepEqual(margs, args.slice(0, margs.length))) {
1497
+ return !strict || margs.length == args.length;
1498
+ }
1499
+ },
1468
1500
 
1469
- returned: function returned(value) {
1470
- return sinon.deepEqual(value, this.returnValue);
1471
- },
1501
+ printf: function (format) {
1502
+ var spy = this;
1503
+ var args = slice.call(arguments, 1);
1504
+ var formatter;
1472
1505
 
1473
- threw: function threw(error) {
1474
- if (typeof error == "undefined" || !this.exception) {
1475
- return !!this.exception;
1476
- }
1506
+ return (format || "").replace(/%(.)/g, function (match, specifyer) {
1507
+ formatter = spyApi.formatters[specifyer];
1477
1508
 
1478
- if (typeof error == "string") {
1479
- return this.exception.name == error;
1509
+ if (typeof formatter == "function") {
1510
+ return formatter.call(null, spy, args);
1511
+ } else if (!isNaN(parseInt(specifyer), 10)) {
1512
+ return sinon.format(args[specifyer - 1]);
1480
1513
  }
1481
1514
 
1482
- return this.exception === error;
1483
- },
1484
-
1485
- calledWithNew: function calledWithNew(thisValue) {
1486
- return this.thisValue instanceof this.proxy;
1487
- },
1515
+ return "%" + specifyer;
1516
+ });
1517
+ }
1518
+ };
1488
1519
 
1489
- calledBefore: function (other) {
1490
- return this.callId < other.callId;
1491
- },
1520
+ function delegateToCalls(method, matchAny, actual, notCalled) {
1521
+ spyApi[method] = function () {
1522
+ if (!this.called) {
1523
+ if (notCalled) {
1524
+ return notCalled.apply(this, arguments);
1525
+ }
1526
+ return false;
1527
+ }
1492
1528
 
1493
- calledAfter: function (other) {
1494
- return this.callId > other.callId;
1495
- },
1529
+ var currentCall;
1530
+ var matches = 0;
1496
1531
 
1497
- callArg: function (pos) {
1498
- this.args[pos]();
1499
- },
1532
+ for (var i = 0, l = this.callCount; i < l; i += 1) {
1533
+ currentCall = this.getCall(i);
1500
1534
 
1501
- callArgWith: function (pos) {
1502
- var args = slice.call(arguments, 1);
1503
- this.args[pos].apply(null, args);
1504
- },
1535
+ if (currentCall[actual || method].apply(currentCall, arguments)) {
1536
+ matches += 1;
1505
1537
 
1506
- "yield": function () {
1507
- var args = this.args;
1508
- for (var i = 0, l = args.length; i < l; ++i) {
1509
- if (typeof args[i] === "function") {
1510
- args[i].apply(null, slice.call(arguments));
1511
- return;
1538
+ if (matchAny) {
1539
+ return true;
1512
1540
  }
1513
1541
  }
1514
- throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
1515
- },
1542
+ }
1516
1543
 
1517
- yieldTo: function (prop) {
1518
- var args = this.args;
1519
- for (var i = 0, l = args.length; i < l; ++i) {
1520
- if (args[i] && typeof args[i][prop] === "function") {
1521
- args[i][prop].apply(null, slice.call(arguments, 1));
1522
- return;
1523
- }
1524
- }
1525
- throwYieldError(this.proxy, " cannot yield to '" + prop +
1526
- "' since no callback was passed.", args);
1527
- },
1544
+ return matches === this.callCount;
1545
+ };
1546
+ }
1528
1547
 
1529
- toString: function () {
1530
- var callStr = this.proxy.toString() + "(";
1531
- var args = [];
1548
+ delegateToCalls("calledOn", true);
1549
+ delegateToCalls("alwaysCalledOn", false, "calledOn");
1550
+ delegateToCalls("calledWith", true);
1551
+ delegateToCalls("calledWithMatch", true);
1552
+ delegateToCalls("alwaysCalledWith", false, "calledWith");
1553
+ delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
1554
+ delegateToCalls("calledWithExactly", true);
1555
+ delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
1556
+ delegateToCalls("neverCalledWith", false, "notCalledWith",
1557
+ function () { return true; });
1558
+ delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch",
1559
+ function () { return true; });
1560
+ delegateToCalls("threw", true);
1561
+ delegateToCalls("alwaysThrew", false, "threw");
1562
+ delegateToCalls("returned", true);
1563
+ delegateToCalls("alwaysReturned", false, "returned");
1564
+ delegateToCalls("calledWithNew", true);
1565
+ delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
1566
+ delegateToCalls("callArg", false, "callArgWith", function () {
1567
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
1568
+ });
1569
+ spyApi.callArgWith = spyApi.callArg;
1570
+ delegateToCalls("callArgOn", false, "callArgOnWith", function () {
1571
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
1572
+ });
1573
+ spyApi.callArgOnWith = spyApi.callArgOn;
1574
+ delegateToCalls("yield", false, "yield", function () {
1575
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
1576
+ });
1577
+ // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
1578
+ spyApi.invokeCallback = spyApi.yield;
1579
+ delegateToCalls("yieldOn", false, "yieldOn", function () {
1580
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
1581
+ });
1582
+ delegateToCalls("yieldTo", false, "yieldTo", function (property) {
1583
+ throw new Error(this.toString() + " cannot yield to '" + property +
1584
+ "' since it was not yet invoked.");
1585
+ });
1586
+ delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
1587
+ throw new Error(this.toString() + " cannot yield to '" + property +
1588
+ "' since it was not yet invoked.");
1589
+ });
1532
1590
 
1533
- for (var i = 0, l = this.args.length; i < l; ++i) {
1534
- push.call(args, sinon.format(this.args[i]));
1535
- }
1591
+ spyApi.formatters = {
1592
+ "c": function (spy) {
1593
+ return sinon.timesInWords(spy.callCount);
1594
+ },
1536
1595
 
1537
- callStr = callStr + args.join(", ") + ")";
1596
+ "n": function (spy) {
1597
+ return spy.toString();
1598
+ },
1599
+
1600
+ "C": function (spy) {
1601
+ var calls = [];
1538
1602
 
1539
- if (typeof this.returnValue != "undefined") {
1540
- callStr += " => " + sinon.format(this.returnValue);
1603
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
1604
+ var stringifiedCall = " " + spy.getCall(i).toString();
1605
+ if (/\n/.test(calls[i - 1])) {
1606
+ stringifiedCall = "\n" + stringifiedCall;
1541
1607
  }
1608
+ push.call(calls, stringifiedCall);
1609
+ }
1542
1610
 
1543
- if (this.exception) {
1544
- callStr += " !" + this.exception.name;
1611
+ return calls.length > 0 ? "\n" + calls.join("\n") : "";
1612
+ },
1545
1613
 
1546
- if (this.exception.message) {
1547
- callStr += "(" + this.exception.message + ")";
1548
- }
1549
- }
1614
+ "t": function (spy) {
1615
+ var objects = [];
1550
1616
 
1551
- return callStr;
1617
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
1618
+ push.call(objects, sinon.format(spy.thisValues[i]));
1552
1619
  }
1553
- };
1554
- callApi.invokeCallback = callApi.yield;
1555
- return callApi;
1556
- }());
1557
1620
 
1558
- spy.spyCall = spyCall;
1621
+ return objects.join(", ");
1622
+ },
1559
1623
 
1560
- // This steps outside the module sandbox and will be removed
1561
- sinon.spyCall = spyCall;
1624
+ "*": function (spy, args) {
1625
+ var formatted = [];
1626
+
1627
+ for (var i = 0, l = args.length; i < l; ++i) {
1628
+ push.call(formatted, sinon.format(args[i]));
1629
+ }
1630
+
1631
+ return formatted.join(", ");
1632
+ }
1633
+ };
1634
+
1635
+ sinon.extend(spy, spyApi);
1636
+
1637
+ spy.spyCall = sinon.spyCall;
1562
1638
 
1563
1639
  if (commonJSModule) {
1564
1640
  module.exports = spy;
@@ -1579,7 +1655,7 @@ var sinon = (function () {
1579
1655
  * @author Christian Johansen (christian@cjohansen.no)
1580
1656
  * @license BSD
1581
1657
  *
1582
- * Copyright (c) 2010-2011 Christian Johansen
1658
+ * Copyright (c) 2010-2013 Christian Johansen
1583
1659
  */
1584
1660
 
1585
1661
  (function (sinon) {
@@ -1625,7 +1701,8 @@ var sinon = (function () {
1625
1701
 
1626
1702
  function getChangingValue(stub, property) {
1627
1703
  var index = stub.callCount - 1;
1628
- var prop = index in stub[property] ? stub[property][index] : stub[property + "Last"];
1704
+ var values = stub[property];
1705
+ var prop = index in values ? values[index] : values[values.length - 1];
1629
1706
  stub[property + "Last"] = prop;
1630
1707
 
1631
1708
  return prop;
@@ -1682,8 +1759,6 @@ var sinon = (function () {
1682
1759
  var nextTick = (function () {
1683
1760
  if (typeof process === "object" && typeof process.nextTick === "function") {
1684
1761
  return process.nextTick;
1685
- } else if (typeof msSetImmediate === "function") {
1686
- return msSetImmediate.bind(window);
1687
1762
  } else if (typeof setImmediate === "function") {
1688
1763
  return setImmediate;
1689
1764
  } else {
@@ -1701,8 +1776,6 @@ var sinon = (function () {
1701
1776
  throw new TypeError(getCallbackError(stub, func, args));
1702
1777
  }
1703
1778
 
1704
- var index = stub.callCount - 1;
1705
-
1706
1779
  var callbackArguments = getChangingValue(stub, "callbackArguments");
1707
1780
  var callbackContext = getChangingValue(stub, "callbackContexts");
1708
1781
 
@@ -1768,6 +1841,25 @@ var sinon = (function () {
1768
1841
  return functionStub;
1769
1842
  },
1770
1843
 
1844
+ resetBehavior: function () {
1845
+ var i;
1846
+
1847
+ this.callArgAts = [];
1848
+ this.callbackArguments = [];
1849
+ this.callbackContexts = [];
1850
+ this.callArgProps = [];
1851
+
1852
+ delete this.returnValue;
1853
+ delete this.returnArgAt;
1854
+ this.returnThis = false;
1855
+
1856
+ if (this.fakes) {
1857
+ for (i = 0; i < this.fakes.length; i++) {
1858
+ this.fakes[i].resetBehavior();
1859
+ }
1860
+ }
1861
+ },
1862
+
1771
1863
  returns: function returns(value) {
1772
1864
  this.returnValue = value;
1773
1865
 
@@ -1934,7 +2026,7 @@ var sinon = (function () {
1934
2026
  * @author Christian Johansen (christian@cjohansen.no)
1935
2027
  * @license BSD
1936
2028
  *
1937
- * Copyright (c) 2010-2011 Christian Johansen
2029
+ * Copyright (c) 2010-2013 Christian Johansen
1938
2030
  */
1939
2031
 
1940
2032
  (function (sinon) {
@@ -2302,7 +2394,8 @@ var sinon = (function () {
2302
2394
  }
2303
2395
 
2304
2396
  var callStr = sinon.spyCall.toString.call({
2305
- proxy: this.method, args: args
2397
+ proxy: this.method || "anonymous mock expectation",
2398
+ args: args
2306
2399
  });
2307
2400
 
2308
2401
  var message = callStr.replace(", [...", "[, ...") + " " +
@@ -2358,7 +2451,7 @@ var sinon = (function () {
2358
2451
  * @author Christian Johansen (christian@cjohansen.no)
2359
2452
  * @license BSD
2360
2453
  *
2361
- * Copyright (c) 2010-2011 Christian Johansen
2454
+ * Copyright (c) 2010-2013 Christian Johansen
2362
2455
  */
2363
2456
 
2364
2457
  (function (sinon) {
@@ -2515,7 +2608,7 @@ var sinon = (function () {
2515
2608
  * @author Christian Johansen (christian@cjohansen.no)
2516
2609
  * @license BSD
2517
2610
  *
2518
- * Copyright (c) 2010-2011 Christian Johansen
2611
+ * Copyright (c) 2010-2013 Christian Johansen
2519
2612
  */
2520
2613
 
2521
2614
  if (typeof sinon == "undefined") {
@@ -2656,6 +2749,8 @@ var sinon = (function () {
2656
2749
  if (firstException) {
2657
2750
  throw firstException;
2658
2751
  }
2752
+
2753
+ return this.now;
2659
2754
  },
2660
2755
 
2661
2756
  firstTimerInRange: function (from, to) {
@@ -2869,15 +2964,16 @@ var sinon = (function () {
2869
2964
  (function () {
2870
2965
  var push = [].push;
2871
2966
 
2872
- sinon.Event = function Event(type, bubbles, cancelable) {
2873
- this.initEvent(type, bubbles, cancelable);
2967
+ sinon.Event = function Event(type, bubbles, cancelable, target) {
2968
+ this.initEvent(type, bubbles, cancelable, target);
2874
2969
  };
2875
2970
 
2876
2971
  sinon.Event.prototype = {
2877
- initEvent: function(type, bubbles, cancelable) {
2972
+ initEvent: function(type, bubbles, cancelable, target) {
2878
2973
  this.type = type;
2879
2974
  this.bubbles = bubbles;
2880
2975
  this.cancelable = cancelable;
2976
+ this.target = target;
2881
2977
  },
2882
2978
 
2883
2979
  stopPropagation: function () {},
@@ -2933,7 +3029,7 @@ var sinon = (function () {
2933
3029
  * @author Christian Johansen (christian@cjohansen.no)
2934
3030
  * @license BSD
2935
3031
  *
2936
- * Copyright (c) 2010-2011 Christian Johansen
3032
+ * Copyright (c) 2010-2013 Christian Johansen
2937
3033
  */
2938
3034
 
2939
3035
  if (typeof sinon == "undefined") {
@@ -2981,6 +3077,18 @@ var sinon = (function () {
2981
3077
  this.status = 0;
2982
3078
  this.statusText = "";
2983
3079
 
3080
+ var xhr = this;
3081
+
3082
+ ["loadstart", "load", "abort", "loadend"].forEach(function (eventName) {
3083
+ xhr.addEventListener(eventName, function (event) {
3084
+ var listener = xhr["on" + eventName];
3085
+
3086
+ if (listener && typeof listener == "function") {
3087
+ listener(event);
3088
+ }
3089
+ });
3090
+ });
3091
+
2984
3092
  if (typeof FakeXMLHttpRequest.onCreate == "function") {
2985
3093
  FakeXMLHttpRequest.onCreate(this);
2986
3094
  }
@@ -3134,6 +3242,13 @@ var sinon = (function () {
3134
3242
  }
3135
3243
 
3136
3244
  this.dispatchEvent(new sinon.Event("readystatechange"));
3245
+
3246
+ switch (this.readyState) {
3247
+ case FakeXMLHttpRequest.DONE:
3248
+ this.dispatchEvent(new sinon.Event("load", false, false, this));
3249
+ this.dispatchEvent(new sinon.Event("loadend", false, false, this));
3250
+ break;
3251
+ }
3137
3252
  },
3138
3253
 
3139
3254
  setRequestHeader: function setRequestHeader(header, value) {
@@ -3162,6 +3277,8 @@ var sinon = (function () {
3162
3277
 
3163
3278
  if (this.async) {
3164
3279
  this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
3280
+ } else {
3281
+ this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
3165
3282
  }
3166
3283
  },
3167
3284
 
@@ -3187,6 +3304,8 @@ var sinon = (function () {
3187
3304
  if (typeof this.onSend == "function") {
3188
3305
  this.onSend(this);
3189
3306
  }
3307
+
3308
+ this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
3190
3309
  },
3191
3310
 
3192
3311
  abort: function abort() {
@@ -3201,6 +3320,11 @@ var sinon = (function () {
3201
3320
  }
3202
3321
 
3203
3322
  this.readyState = sinon.FakeXMLHttpRequest.UNSENT;
3323
+
3324
+ this.dispatchEvent(new sinon.Event("abort", false, false, this));
3325
+ if (typeof this.onerror === "function") {
3326
+ this.onerror();
3327
+ }
3204
3328
  },
3205
3329
 
3206
3330
  getResponseHeader: function getResponseHeader(header) {
@@ -3281,6 +3405,10 @@ var sinon = (function () {
3281
3405
  this.status = typeof status == "number" ? status : 200;
3282
3406
  this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
3283
3407
  this.setResponseBody(body || "");
3408
+ if (typeof this.onload === "function"){
3409
+ this.onload();
3410
+ }
3411
+
3284
3412
  }
3285
3413
  });
3286
3414
 
@@ -3407,7 +3535,7 @@ var sinon = (function () {
3407
3535
  * @author Christian Johansen (christian@cjohansen.no)
3408
3536
  * @license BSD
3409
3537
  *
3410
- * Copyright (c) 2010-2011 Christian Johansen
3538
+ * Copyright (c) 2010-2013 Christian Johansen
3411
3539
  */
3412
3540
 
3413
3541
  if (typeof sinon == "undefined") {
@@ -3471,6 +3599,15 @@ var sinon = (function () {
3471
3599
  return false;
3472
3600
  }
3473
3601
 
3602
+ function log(response, request) {
3603
+ var str;
3604
+
3605
+ str = "Request:\n" + sinon.format(request) + "\n\n";
3606
+ str += "Response:\n" + sinon.format(response) + "\n\n";
3607
+
3608
+ sinon.log(str);
3609
+ }
3610
+
3474
3611
  return {
3475
3612
  create: function () {
3476
3613
  var server = create(this);
@@ -3577,6 +3714,8 @@ var sinon = (function () {
3577
3714
  }
3578
3715
 
3579
3716
  if (request.readyState != 4) {
3717
+ log(response, request);
3718
+
3580
3719
  request.respond(response[0], response[1], response[2]);
3581
3720
  }
3582
3721
  } catch (e) {
@@ -3612,7 +3751,7 @@ var sinon = (function () {
3612
3751
  * @author Christian Johansen (christian@cjohansen.no)
3613
3752
  * @license BSD
3614
3753
  *
3615
- * Copyright (c) 2010-2011 Christian Johansen
3754
+ * Copyright (c) 2010-2013 Christian Johansen
3616
3755
  */
3617
3756
 
3618
3757
  (function () {
@@ -3692,7 +3831,7 @@ var sinon = (function () {
3692
3831
  * @author Christian Johansen (christian@cjohansen.no)
3693
3832
  * @license BSD
3694
3833
  *
3695
- * Copyright (c) 2010-2011 Christian Johansen
3834
+ * Copyright (c) 2010-2013 Christian Johansen
3696
3835
  */
3697
3836
 
3698
3837
  if (typeof module == "object" && typeof require == "function") {
@@ -3816,7 +3955,7 @@ var sinon = (function () {
3816
3955
  * @author Christian Johansen (christian@cjohansen.no)
3817
3956
  * @license BSD
3818
3957
  *
3819
- * Copyright (c) 2010-2011 Christian Johansen
3958
+ * Copyright (c) 2010-2013 Christian Johansen
3820
3959
  */
3821
3960
 
3822
3961
  (function (sinon) {
@@ -3889,7 +4028,7 @@ var sinon = (function () {
3889
4028
  * @author Christian Johansen (christian@cjohansen.no)
3890
4029
  * @license BSD
3891
4030
  *
3892
- * Copyright (c) 2010-2011 Christian Johansen
4031
+ * Copyright (c) 2010-2013 Christian Johansen
3893
4032
  */
3894
4033
 
3895
4034
  (function (sinon) {
@@ -3986,7 +4125,7 @@ var sinon = (function () {
3986
4125
  * @author Christian Johansen (christian@cjohansen.no)
3987
4126
  * @license BSD
3988
4127
  *
3989
- * Copyright (c) 2010-2011 Christian Johansen
4128
+ * Copyright (c) 2010-2013 Christian Johansen
3990
4129
  */
3991
4130
 
3992
4131
  (function (sinon, global) {
@@ -4079,7 +4218,14 @@ var sinon = (function () {
4079
4218
  if (!sinon.calledInOrder(arguments)) {
4080
4219
  try {
4081
4220
  expected = [].join.call(arguments, ", ");
4082
- actual = sinon.orderByFirstCall(slice.call(arguments)).join(", ");
4221
+ var calls = slice.call(arguments);
4222
+ var i = calls.length;
4223
+ while (i) {
4224
+ if (!calls[--i].called) {
4225
+ calls.splice(i, 1);
4226
+ }
4227
+ }
4228
+ actual = sinon.orderByFirstCall(calls).join(", ");
4083
4229
  } catch (e) {
4084
4230
  // If this fails, we'll just fall back to the blank string
4085
4231
  }
@@ -4148,6 +4294,6 @@ var sinon = (function () {
4148
4294
  } else {
4149
4295
  sinon.assert = assert;
4150
4296
  }
4151
- }(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : global));
4297
+ }(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
4152
4298
 
4153
4299
  return sinon;}.call(typeof window != 'undefined' && window || {}));