upjs-rails 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/dist/up.js +138 -81
  4. data/dist/up.min.js +2 -2
  5. data/lib/assets/javascripts/up/boot.js.coffee +3 -0
  6. data/lib/assets/javascripts/up/browser.js.coffee +42 -26
  7. data/lib/assets/javascripts/up/flow.js.coffee +6 -4
  8. data/lib/assets/javascripts/up/history.js.coffee +1 -1
  9. data/lib/assets/javascripts/up/modal.js.coffee +4 -4
  10. data/lib/assets/javascripts/up/motion.js.coffee +6 -4
  11. data/lib/assets/javascripts/up/proxy.js.coffee +2 -1
  12. data/lib/assets/javascripts/up/util.js.coffee +61 -32
  13. data/lib/assets/javascripts/up.js.coffee +1 -10
  14. data/lib/upjs/rails/version.rb +1 -1
  15. data/spec_app/config/environments/development.rb +1 -1
  16. data/spec_app/spec/javascripts/helpers/reset_path.js.coffee +3 -2
  17. data/spec_app/spec/javascripts/up/flow_spec.js.coffee +1 -1
  18. data/spec_app/spec/javascripts/up/history_spec.js.coffee +53 -47
  19. data/spec_app/spec/javascripts/up/link_spec.js.coffee +1 -1
  20. data/spec_app/spec/javascripts/up/motion_spec.js.coffee +4 -4
  21. data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +18 -9
  22. data/spec_app/vendor/assets/bower_components/jasmine/.bower.json +43 -7
  23. data/spec_app/vendor/assets/bower_components/jasmine/CONTRIBUTING.md +26 -17
  24. data/spec_app/vendor/assets/bower_components/jasmine/README.md +27 -18
  25. data/spec_app/vendor/assets/bower_components/jasmine/RELEASE.md +15 -5
  26. data/spec_app/vendor/assets/bower_components/jasmine/bower.json +41 -0
  27. data/spec_app/vendor/assets/bower_components/jasmine/lib/console/console.js +27 -3
  28. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot.js +10 -9
  29. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/{src → lib/jasmine_examples}/Player.js +0 -0
  30. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/{src → lib/jasmine_examples}/Song.js +0 -0
  31. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine-html.js +76 -20
  32. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.css +15 -18
  33. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/jasmine.js +1399 -694
  34. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/json2.js +73 -62
  35. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/node_boot.js +1 -1
  36. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.js +29 -31
  37. data/spec_app/vendor/assets/bower_components/jasmine/package.json +18 -7
  38. data/spec_app/vendor/assets/bower_components/jasmine-ajax/.bower.json +11 -13
  39. data/spec_app/vendor/assets/bower_components/jasmine-ajax/MIT.LICENSE +1 -1
  40. data/spec_app/vendor/assets/bower_components/jasmine-ajax/README.markdown +198 -125
  41. data/spec_app/vendor/assets/bower_components/jasmine-ajax/bower.json +9 -10
  42. data/spec_app/vendor/assets/bower_components/jasmine-ajax/lib/mock-ajax.js +250 -59
  43. data/spec_app/vendor/assets/bower_components/jasmine-ajax/package.json +9 -4
  44. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.0.2.md +50 -0
  45. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/2.99.md +14 -0
  46. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.0.md +28 -0
  47. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.0.md +24 -0
  48. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.1.1.md +23 -0
  49. data/spec_app/vendor/assets/bower_components/jasmine-ajax/release_notes/3.2.0.md +20 -0
  50. data/spec_app/vendor/assets/bower_components/jasmine-fixture/.bower.json +4 -4
  51. data/spec_app/vendor/assets/bower_components/jasmine-fixture/bower.json +1 -1
  52. data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.js +4 -4
  53. data/spec_app/vendor/assets/bower_components/jasmine-fixture/dist/jasmine-fixture.min.js +2 -2
  54. data/spec_app/vendor/assets/bower_components/jasmine-jquery/.bower.json +4 -4
  55. data/spec_app/vendor/assets/bower_components/jasmine-jquery/Gruntfile.js +17 -1
  56. data/spec_app/vendor/assets/bower_components/jasmine-jquery/{MIT.LICENSE → LICENSE} +0 -0
  57. data/spec_app/vendor/assets/bower_components/jasmine-jquery/README.md +14 -9
  58. data/spec_app/vendor/assets/bower_components/jasmine-jquery/bower.json +0 -1
  59. data/spec_app/vendor/assets/bower_components/jasmine-jquery/lib/jasmine-jquery.js +35 -10
  60. data/spec_app/vendor/assets/bower_components/jasmine-jquery/package.json +33 -24
  61. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/fixtures/fixture_with_checkbox_with_checked.html +6 -0
  62. data/spec_app/vendor/assets/bower_components/jasmine-jquery/spec/suites/jasmine-jquery-spec.js +61 -1
  63. data/spec_app/vendor/assets/bower_components/jquery/.bower.json +5 -4
  64. data/spec_app/vendor/assets/bower_components/jquery/bower.json +2 -1
  65. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.js +9 -4
  66. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.js +4 -4
  67. data/spec_app/vendor/assets/bower_components/jquery/dist/jquery.min.map +1 -1
  68. data/spec_app/vendor/assets/bower_components/jquery/src/core.js +6 -1
  69. metadata +14 -175
  70. data/spec_app/vendor/assets/bower_components/jasmine/.gitignore +0 -24
  71. data/spec_app/vendor/assets/bower_components/jasmine/.gitmodules +0 -3
  72. data/spec_app/vendor/assets/bower_components/jasmine/.jshintrc +0 -9
  73. data/spec_app/vendor/assets/bower_components/jasmine/.npmignore +0 -21
  74. data/spec_app/vendor/assets/bower_components/jasmine/.rspec +0 -1
  75. data/spec_app/vendor/assets/bower_components/jasmine/.travis.yml +0 -51
  76. data/spec_app/vendor/assets/bower_components/jasmine/Gemfile +0 -12
  77. data/spec_app/vendor/assets/bower_components/jasmine/Gruntfile.js +0 -53
  78. data/spec_app/vendor/assets/bower_components/jasmine/Rakefile +0 -18
  79. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.0.0.zip +0 -0
  80. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.1.0.zip +0 -0
  81. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.2.0.zip +0 -0
  82. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.3.0.zip +0 -0
  83. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-1.3.1.zip +0 -0
  84. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.0.zip +0 -0
  85. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.1.zip +0 -0
  86. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.2.zip +0 -0
  87. data/spec_app/vendor/assets/bower_components/jasmine/dist/jasmine-standalone-2.0.3.zip +0 -0
  88. data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/compass.js +0 -10
  89. data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/compress.js +0 -66
  90. data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/concat.js +0 -61
  91. data/spec_app/vendor/assets/bower_components/jasmine/grunt/config/jshint.js +0 -11
  92. data/spec_app/vendor/assets/bower_components/jasmine/grunt/tasks/build_standalone.js +0 -31
  93. data/spec_app/vendor/assets/bower_components/jasmine/grunt/tasks/version.js +0 -14
  94. data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/SpecRunner.html.jst +0 -26
  95. data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/licenseBanner.js.jst +0 -22
  96. data/spec_app/vendor/assets/bower_components/jasmine/grunt/templates/version.rb.jst +0 -9
  97. data/spec_app/vendor/assets/bower_components/jasmine/images/__init__.py +0 -0
  98. data/spec_app/vendor/assets/bower_components/jasmine/jasmine-core.gemspec +0 -23
  99. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/__init__.py +0 -1
  100. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot/boot.js +0 -120
  101. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/boot/node_boot.js +0 -19
  102. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/core.py +0 -60
  103. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/spec/PlayerSpec.js +0 -60
  104. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/node_example/spec/SpecHelper.js +0 -15
  105. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/spec/PlayerSpec.js +0 -58
  106. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/spec/SpecHelper.js +0 -15
  107. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/src/Player.js +0 -22
  108. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/example/src/Song.js +0 -7
  109. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core/version.rb +0 -9
  110. data/spec_app/vendor/assets/bower_components/jasmine/lib/jasmine-core.rb +0 -53
  111. data/spec_app/vendor/assets/bower_components/jasmine/release_notes/2.0.1.md +0 -70
  112. data/spec_app/vendor/assets/bower_components/jasmine/release_notes/2.0.2.md +0 -25
  113. data/spec_app/vendor/assets/bower_components/jasmine/release_notes/20.md +0 -179
  114. data/spec_app/vendor/assets/bower_components/jasmine/setup.py +0 -47
  115. data/spec_app/vendor/assets/bower_components/jasmine/spec/console/ConsoleReporterSpec.js +0 -239
  116. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/AnySpec.js +0 -46
  117. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/CallTrackerSpec.js +0 -105
  118. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ClockSpec.js +0 -445
  119. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/DelayedFunctionSchedulerSpec.js +0 -246
  120. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/EnvSpec.js +0 -85
  121. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionFormatterSpec.js +0 -63
  122. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js +0 -68
  123. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExpectationResultSpec.js +0 -61
  124. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ExpectationSpec.js +0 -427
  125. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/JsApiReporterSpec.js +0 -214
  126. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/MockDateSpec.js +0 -199
  127. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ObjectContainingSpec.js +0 -70
  128. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/PrettyPrintSpec.js +0 -156
  129. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/QueueRunnerSpec.js +0 -271
  130. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/ReportDispatcherSpec.js +0 -40
  131. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpecSpec.js +0 -260
  132. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpySpec.js +0 -67
  133. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SpyStrategySpec.js +0 -111
  134. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/SuiteSpec.js +0 -216
  135. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/TimerSpec.js +0 -31
  136. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/UtilSpec.js +0 -28
  137. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/CustomMatchersSpec.js +0 -149
  138. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/EnvSpec.js +0 -506
  139. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/integration/SpecRunningSpec.js +0 -306
  140. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/matchersUtilSpec.js +0 -239
  141. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeCloseToSpec.js +0 -51
  142. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeDefinedSpec.js +0 -18
  143. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeFalsySpec.js +0 -38
  144. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeGreaterThanSpec.js +0 -20
  145. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeLessThanSpec.js +0 -20
  146. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeNaNSpec.js +0 -37
  147. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeNullSpec.js +0 -17
  148. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeSpec.js +0 -17
  149. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeTruthySpec.js +0 -38
  150. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toBeUndefinedSpec.js +0 -18
  151. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toContainSpec.js +0 -26
  152. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toEqualSpec.js +0 -28
  153. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toHaveBeenCalledSpec.js +0 -47
  154. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toHaveBeenCalledWithSpec.js +0 -66
  155. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toMatchSpec.js +0 -34
  156. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toThrowErrorSpec.js +0 -280
  157. data/spec_app/vendor/assets/bower_components/jasmine/spec/core/matchers/toThrowSpec.js +0 -99
  158. data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/BrowserFlags.js +0 -23
  159. data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/defineJasmineUnderTest.js +0 -7
  160. data/spec_app/vendor/assets/bower_components/jasmine/spec/helpers/nodeDefineJasmineUnderTest.js +0 -33
  161. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/HtmlReporterSpec.js +0 -616
  162. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/HtmlSpecFilterSpec.js +0 -18
  163. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/MatchersHtmlSpec.js +0 -37
  164. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/PrettyPrintHtmlSpec.js +0 -15
  165. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/QueryStringSpec.js +0 -43
  166. data/spec_app/vendor/assets/bower_components/jasmine/spec/html/ResultsNodeSpec.js +0 -62
  167. data/spec_app/vendor/assets/bower_components/jasmine/spec/javascripts/support/jasmine_selenium_runner.yml +0 -16
  168. data/spec_app/vendor/assets/bower_components/jasmine/spec/performance/large_object_test.js +0 -36
  169. data/spec_app/vendor/assets/bower_components/jasmine/spec/performance/performance_test.js +0 -10
  170. data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine-performance.json +0 -9
  171. data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine-performance.yml +0 -9
  172. data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine.json +0 -10
  173. data/spec_app/vendor/assets/bower_components/jasmine/spec/support/jasmine.yml +0 -25
  174. data/spec_app/vendor/assets/bower_components/jasmine/src/console/ConsoleReporter.js +0 -131
  175. data/spec_app/vendor/assets/bower_components/jasmine/src/console/requireConsole.js +0 -12
  176. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Any.js +0 -36
  177. data/spec_app/vendor/assets/bower_components/jasmine/src/core/CallTracker.js +0 -50
  178. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Clock.js +0 -113
  179. data/spec_app/vendor/assets/bower_components/jasmine/src/core/DelayedFunctionScheduler.js +0 -145
  180. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Env.js +0 -341
  181. data/spec_app/vendor/assets/bower_components/jasmine/src/core/ExceptionFormatter.js +0 -29
  182. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Expectation.js +0 -107
  183. data/spec_app/vendor/assets/bower_components/jasmine/src/core/ExpectationResult.js +0 -45
  184. data/spec_app/vendor/assets/bower_components/jasmine/src/core/JsApiReporter.js +0 -73
  185. data/spec_app/vendor/assets/bower_components/jasmine/src/core/MockDate.js +0 -81
  186. data/spec_app/vendor/assets/bower_components/jasmine/src/core/ObjectContaining.js +0 -34
  187. data/spec_app/vendor/assets/bower_components/jasmine/src/core/PrettyPrinter.js +0 -137
  188. data/spec_app/vendor/assets/bower_components/jasmine/src/core/QueueRunner.js +0 -92
  189. data/spec_app/vendor/assets/bower_components/jasmine/src/core/ReportDispatcher.js +0 -35
  190. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Spec.js +0 -126
  191. data/spec_app/vendor/assets/bower_components/jasmine/src/core/SpyStrategy.js +0 -51
  192. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Suite.js +0 -92
  193. data/spec_app/vendor/assets/bower_components/jasmine/src/core/Timer.js +0 -22
  194. data/spec_app/vendor/assets/bower_components/jasmine/src/core/base.js +0 -102
  195. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/matchersUtil.js +0 -181
  196. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/requireMatchers.js +0 -29
  197. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBe.js +0 -13
  198. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeCloseTo.js +0 -18
  199. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeDefined.js +0 -13
  200. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeFalsy.js +0 -13
  201. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeGreaterThan.js +0 -15
  202. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeLessThan.js +0 -14
  203. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeNaN.js +0 -22
  204. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeNull.js +0 -14
  205. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeTruthy.js +0 -14
  206. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toBeUndefined.js +0 -14
  207. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toContain.js +0 -16
  208. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toEqual.js +0 -20
  209. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toHaveBeenCalled.js +0 -28
  210. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toHaveBeenCalledWith.js +0 -33
  211. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toMatch.js +0 -16
  212. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrow.js +0 -46
  213. data/spec_app/vendor/assets/bower_components/jasmine/src/core/matchers/toThrowError.js +0 -156
  214. data/spec_app/vendor/assets/bower_components/jasmine/src/core/requireCore.js +0 -39
  215. data/spec_app/vendor/assets/bower_components/jasmine/src/core/requireInterface.js +0 -59
  216. data/spec_app/vendor/assets/bower_components/jasmine/src/core/util.js +0 -44
  217. data/spec_app/vendor/assets/bower_components/jasmine/src/html/HtmlReporter.js +0 -280
  218. data/spec_app/vendor/assets/bower_components/jasmine/src/html/HtmlSpecFilter.js +0 -12
  219. data/spec_app/vendor/assets/bower_components/jasmine/src/html/QueryString.js +0 -47
  220. data/spec_app/vendor/assets/bower_components/jasmine/src/html/ResultsNode.js +0 -19
  221. data/spec_app/vendor/assets/bower_components/jasmine/src/html/_HTMLReporter.scss +0 -355
  222. data/spec_app/vendor/assets/bower_components/jasmine/src/html/jasmine.scss +0 -1
  223. data/spec_app/vendor/assets/bower_components/jasmine/src/html/requireHtml.js +0 -6
  224. data/spec_app/vendor/assets/bower_components/jasmine/src/templates/example_project_jasmine_tags.html.erb +0 -3
  225. data/spec_app/vendor/assets/bower_components/jasmine/src/templates/version.js.erb +0 -7
  226. data/spec_app/vendor/assets/bower_components/jasmine/src/templates/version.rb.erb +0 -6
  227. data/spec_app/vendor/assets/bower_components/jasmine/src/version.js +0 -3
  228. data/spec_app/vendor/assets/bower_components/jasmine/travis-core-script.sh +0 -14
  229. data/spec_app/vendor/assets/bower_components/jasmine/travis-docs-script.sh +0 -5
  230. data/spec_app/vendor/assets/bower_components/jasmine/travis-node-script.sh +0 -6
  231. data/spec_app/vendor/assets/bower_components/jasmine-ajax/Gruntfile.js +0 -63
  232. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/boot.js +0 -11
  233. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/fakeRequest.js +0 -262
  234. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/mockAjax.js +0 -45
  235. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/paramParser.js +0 -56
  236. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requestStub.js +0 -42
  237. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requestTracker.js +0 -51
  238. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/requireAjax.js +0 -44
  239. data/spec_app/vendor/assets/bower_components/jasmine-ajax/src/stubTracker.js +0 -24
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (c) 2008-2014 Pivotal Labs
2
+ Copyright (c) 2008-2015 Pivotal Labs
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
@@ -20,45 +20,62 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
20
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
- function getJasmineRequireObj() {
23
+ var getJasmineRequireObj = (function (jasmineGlobal) {
24
+ var jasmineRequire;
25
+
24
26
  if (typeof module !== 'undefined' && module.exports) {
25
- return exports;
27
+ jasmineGlobal = global;
28
+ jasmineRequire = exports;
26
29
  } else {
27
- window.jasmineRequire = window.jasmineRequire || {};
28
- return window.jasmineRequire;
30
+ if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
31
+ jasmineGlobal = window;
32
+ }
33
+ jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {};
29
34
  }
30
- }
31
35
 
32
- getJasmineRequireObj().core = function(jRequire) {
33
- var j$ = {};
34
-
35
- jRequire.base(j$);
36
- j$.util = jRequire.util();
37
- j$.Any = jRequire.Any();
38
- j$.CallTracker = jRequire.CallTracker();
39
- j$.MockDate = jRequire.MockDate();
40
- j$.Clock = jRequire.Clock();
41
- j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
42
- j$.Env = jRequire.Env(j$);
43
- j$.ExceptionFormatter = jRequire.ExceptionFormatter();
44
- j$.Expectation = jRequire.Expectation();
45
- j$.buildExpectationResult = jRequire.buildExpectationResult();
46
- j$.JsApiReporter = jRequire.JsApiReporter();
47
- j$.matchersUtil = jRequire.matchersUtil(j$);
48
- j$.ObjectContaining = jRequire.ObjectContaining(j$);
49
- j$.pp = jRequire.pp(j$);
50
- j$.QueueRunner = jRequire.QueueRunner(j$);
51
- j$.ReportDispatcher = jRequire.ReportDispatcher();
52
- j$.Spec = jRequire.Spec(j$);
53
- j$.SpyStrategy = jRequire.SpyStrategy();
54
- j$.Suite = jRequire.Suite();
55
- j$.Timer = jRequire.Timer();
56
- j$.version = jRequire.version();
57
-
58
- j$.matchers = jRequire.requireMatchers(jRequire, j$);
59
-
60
- return j$;
61
- };
36
+ function getJasmineRequire() {
37
+ return jasmineRequire;
38
+ }
39
+
40
+ getJasmineRequire().core = function(jRequire) {
41
+ var j$ = {};
42
+
43
+ jRequire.base(j$, jasmineGlobal);
44
+ j$.util = jRequire.util();
45
+ j$.errors = jRequire.errors();
46
+ j$.Any = jRequire.Any(j$);
47
+ j$.Anything = jRequire.Anything(j$);
48
+ j$.CallTracker = jRequire.CallTracker();
49
+ j$.MockDate = jRequire.MockDate();
50
+ j$.Clock = jRequire.Clock();
51
+ j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
52
+ j$.Env = jRequire.Env(j$);
53
+ j$.ExceptionFormatter = jRequire.ExceptionFormatter();
54
+ j$.Expectation = jRequire.Expectation();
55
+ j$.buildExpectationResult = jRequire.buildExpectationResult();
56
+ j$.JsApiReporter = jRequire.JsApiReporter();
57
+ j$.matchersUtil = jRequire.matchersUtil(j$);
58
+ j$.ObjectContaining = jRequire.ObjectContaining(j$);
59
+ j$.ArrayContaining = jRequire.ArrayContaining(j$);
60
+ j$.pp = jRequire.pp(j$);
61
+ j$.QueueRunner = jRequire.QueueRunner(j$);
62
+ j$.ReportDispatcher = jRequire.ReportDispatcher();
63
+ j$.Spec = jRequire.Spec(j$);
64
+ j$.SpyRegistry = jRequire.SpyRegistry(j$);
65
+ j$.SpyStrategy = jRequire.SpyStrategy();
66
+ j$.StringMatching = jRequire.StringMatching(j$);
67
+ j$.Suite = jRequire.Suite(j$);
68
+ j$.Timer = jRequire.Timer();
69
+ j$.TreeProcessor = jRequire.TreeProcessor();
70
+ j$.version = jRequire.version();
71
+
72
+ j$.matchers = jRequire.requireMatchers(jRequire, j$);
73
+
74
+ return j$;
75
+ };
76
+
77
+ return getJasmineRequire;
78
+ })(this);
62
79
 
63
80
  getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
64
81
  var availableMatchers = [
@@ -90,108 +107,128 @@ getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
90
107
  return matchers;
91
108
  };
92
109
 
93
- getJasmineRequireObj().base = (function (jasmineGlobal) {
94
- if (typeof module !== 'undefined' && module.exports) {
95
- jasmineGlobal = global;
96
- }
110
+ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
111
+ j$.unimplementedMethod_ = function() {
112
+ throw new Error('unimplemented method');
113
+ };
97
114
 
98
- return function(j$) {
99
- j$.unimplementedMethod_ = function() {
100
- throw new Error('unimplemented method');
101
- };
115
+ j$.MAX_PRETTY_PRINT_DEPTH = 40;
116
+ j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
117
+ j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
102
118
 
103
- j$.MAX_PRETTY_PRINT_DEPTH = 40;
104
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
105
- j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
119
+ j$.getGlobal = function() {
120
+ return jasmineGlobal;
121
+ };
106
122
 
107
- j$.getGlobal = function() {
108
- return jasmineGlobal;
109
- };
123
+ j$.getEnv = function(options) {
124
+ var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
125
+ //jasmine. singletons in here (setTimeout blah blah).
126
+ return env;
127
+ };
110
128
 
111
- j$.getEnv = function(options) {
112
- var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
113
- //jasmine. singletons in here (setTimeout blah blah).
114
- return env;
115
- };
129
+ j$.isArray_ = function(value) {
130
+ return j$.isA_('Array', value);
131
+ };
116
132
 
117
- j$.isArray_ = function(value) {
118
- return j$.isA_('Array', value);
119
- };
133
+ j$.isString_ = function(value) {
134
+ return j$.isA_('String', value);
135
+ };
120
136
 
121
- j$.isString_ = function(value) {
122
- return j$.isA_('String', value);
123
- };
137
+ j$.isNumber_ = function(value) {
138
+ return j$.isA_('Number', value);
139
+ };
124
140
 
125
- j$.isNumber_ = function(value) {
126
- return j$.isA_('Number', value);
127
- };
141
+ j$.isA_ = function(typeName, value) {
142
+ return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
143
+ };
128
144
 
129
- j$.isA_ = function(typeName, value) {
130
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
131
- };
145
+ j$.isDomNode = function(obj) {
146
+ return obj.nodeType > 0;
147
+ };
132
148
 
133
- j$.isDomNode = function(obj) {
134
- return obj.nodeType > 0;
135
- };
149
+ j$.fnNameFor = function(func) {
150
+ return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
151
+ };
136
152
 
137
- j$.any = function(clazz) {
138
- return new j$.Any(clazz);
139
- };
153
+ j$.any = function(clazz) {
154
+ return new j$.Any(clazz);
155
+ };
140
156
 
141
- j$.objectContaining = function(sample) {
142
- return new j$.ObjectContaining(sample);
143
- };
157
+ j$.anything = function() {
158
+ return new j$.Anything();
159
+ };
144
160
 
145
- j$.createSpy = function(name, originalFn) {
161
+ j$.objectContaining = function(sample) {
162
+ return new j$.ObjectContaining(sample);
163
+ };
146
164
 
147
- var spyStrategy = new j$.SpyStrategy({
148
- name: name,
149
- fn: originalFn,
150
- getSpy: function() { return spy; }
151
- }),
152
- callTracker = new j$.CallTracker(),
153
- spy = function() {
154
- callTracker.track({
155
- object: this,
156
- args: Array.prototype.slice.apply(arguments)
157
- });
158
- return spyStrategy.exec.apply(this, arguments);
165
+ j$.stringMatching = function(expected) {
166
+ return new j$.StringMatching(expected);
167
+ };
168
+
169
+ j$.arrayContaining = function(sample) {
170
+ return new j$.ArrayContaining(sample);
171
+ };
172
+
173
+ j$.createSpy = function(name, originalFn) {
174
+
175
+ var spyStrategy = new j$.SpyStrategy({
176
+ name: name,
177
+ fn: originalFn,
178
+ getSpy: function() { return spy; }
179
+ }),
180
+ callTracker = new j$.CallTracker(),
181
+ spy = function() {
182
+ var callData = {
183
+ object: this,
184
+ args: Array.prototype.slice.apply(arguments)
159
185
  };
160
186
 
161
- for (var prop in originalFn) {
162
- if (prop === 'and' || prop === 'calls') {
163
- throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
164
- }
187
+ callTracker.track(callData);
188
+ var returnValue = spyStrategy.exec.apply(this, arguments);
189
+ callData.returnValue = returnValue;
190
+
191
+ return returnValue;
192
+ };
165
193
 
166
- spy[prop] = originalFn[prop];
194
+ for (var prop in originalFn) {
195
+ if (prop === 'and' || prop === 'calls') {
196
+ throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
167
197
  }
168
198
 
169
- spy.and = spyStrategy;
170
- spy.calls = callTracker;
199
+ spy[prop] = originalFn[prop];
200
+ }
171
201
 
172
- return spy;
173
- };
202
+ spy.and = spyStrategy;
203
+ spy.calls = callTracker;
174
204
 
175
- j$.isSpy = function(putativeSpy) {
176
- if (!putativeSpy) {
177
- return false;
178
- }
179
- return putativeSpy.and instanceof j$.SpyStrategy &&
180
- putativeSpy.calls instanceof j$.CallTracker;
181
- };
205
+ return spy;
206
+ };
182
207
 
183
- j$.createSpyObj = function(baseName, methodNames) {
184
- if (!j$.isArray_(methodNames) || methodNames.length === 0) {
185
- throw 'createSpyObj requires a non-empty array of method names to create spies for';
186
- }
187
- var obj = {};
188
- for (var i = 0; i < methodNames.length; i++) {
189
- obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
190
- }
191
- return obj;
192
- };
208
+ j$.isSpy = function(putativeSpy) {
209
+ if (!putativeSpy) {
210
+ return false;
211
+ }
212
+ return putativeSpy.and instanceof j$.SpyStrategy &&
213
+ putativeSpy.calls instanceof j$.CallTracker;
193
214
  };
194
- })(this);
215
+
216
+ j$.createSpyObj = function(baseName, methodNames) {
217
+ if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) {
218
+ methodNames = baseName;
219
+ baseName = 'unknown';
220
+ }
221
+
222
+ if (!j$.isArray_(methodNames) || methodNames.length === 0) {
223
+ throw 'createSpyObj requires a non-empty array of method names to create spies for';
224
+ }
225
+ var obj = {};
226
+ for (var i = 0; i < methodNames.length; i++) {
227
+ obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
228
+ }
229
+ return obj;
230
+ };
231
+ };
195
232
 
196
233
  getJasmineRequireObj().util = function() {
197
234
 
@@ -228,13 +265,28 @@ getJasmineRequireObj().util = function() {
228
265
  util.arrayContains = function(array, search) {
229
266
  var i = array.length;
230
267
  while (i--) {
231
- if (array[i] == search) {
268
+ if (array[i] === search) {
232
269
  return true;
233
270
  }
234
271
  }
235
272
  return false;
236
273
  };
237
274
 
275
+ util.clone = function(obj) {
276
+ if (Object.prototype.toString.apply(obj) === '[object Array]') {
277
+ return obj.slice();
278
+ }
279
+
280
+ var cloned = {};
281
+ for (var prop in obj) {
282
+ if (obj.hasOwnProperty(prop)) {
283
+ cloned[prop] = obj[prop];
284
+ }
285
+ }
286
+
287
+ return cloned;
288
+ };
289
+
238
290
  return util;
239
291
  };
240
292
 
@@ -244,17 +296,17 @@ getJasmineRequireObj().Spec = function(j$) {
244
296
  this.resultCallback = attrs.resultCallback || function() {};
245
297
  this.id = attrs.id;
246
298
  this.description = attrs.description || '';
247
- this.fn = attrs.fn;
248
- this.beforeFns = attrs.beforeFns || function() { return []; };
249
- this.afterFns = attrs.afterFns || function() { return []; };
299
+ this.queueableFn = attrs.queueableFn;
300
+ this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
301
+ this.userContext = attrs.userContext || function() { return {}; };
250
302
  this.onStart = attrs.onStart || function() {};
251
- this.exceptionFormatter = attrs.exceptionFormatter || function() {};
252
303
  this.getSpecName = attrs.getSpecName || function() { return ''; };
253
304
  this.expectationResultFactory = attrs.expectationResultFactory || function() { };
254
305
  this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
255
306
  this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
307
+ this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
256
308
 
257
- if (!this.fn) {
309
+ if (!this.queueableFn.fn) {
258
310
  this.pend();
259
311
  }
260
312
 
@@ -263,16 +315,21 @@ getJasmineRequireObj().Spec = function(j$) {
263
315
  description: this.description,
264
316
  fullName: this.getFullName(),
265
317
  failedExpectations: [],
266
- passedExpectations: []
318
+ passedExpectations: [],
319
+ pendingReason: ''
267
320
  };
268
321
  }
269
322
 
270
- Spec.prototype.addExpectationResult = function(passed, data) {
323
+ Spec.prototype.addExpectationResult = function(passed, data, isError) {
271
324
  var expectationResult = this.expectationResultFactory(data);
272
325
  if (passed) {
273
326
  this.result.passedExpectations.push(expectationResult);
274
327
  } else {
275
328
  this.result.failedExpectations.push(expectationResult);
329
+
330
+ if (this.throwOnExpectationFailure && !isError) {
331
+ throw new j$.errors.ExpectationFailed();
332
+ }
276
333
  }
277
334
  };
278
335
 
@@ -280,42 +337,28 @@ getJasmineRequireObj().Spec = function(j$) {
280
337
  return this.expectationFactory(actual, this);
281
338
  };
282
339
 
283
- Spec.prototype.execute = function(onComplete) {
340
+ Spec.prototype.execute = function(onComplete, enabled) {
284
341
  var self = this;
285
342
 
286
343
  this.onStart(this);
287
344
 
288
- if (this.markedPending || this.disabled) {
289
- complete();
345
+ if (!this.isExecutable() || this.markedPending || enabled === false) {
346
+ complete(enabled);
290
347
  return;
291
348
  }
292
349
 
293
- var allFns = this.beforeFns().concat(this.fn).concat(this.afterFns());
350
+ var fns = this.beforeAndAfterFns();
351
+ var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
294
352
 
295
353
  this.queueRunnerFactory({
296
- fns: allFns,
297
- onException: onException,
354
+ queueableFns: allFns,
355
+ onException: function() { self.onException.apply(self, arguments); },
298
356
  onComplete: complete,
299
- enforceTimeout: function() { return true; }
357
+ userContext: this.userContext()
300
358
  });
301
359
 
302
- function onException(e) {
303
- if (Spec.isPendingSpecException(e)) {
304
- self.pend();
305
- return;
306
- }
307
-
308
- self.addExpectationResult(false, {
309
- matcherName: '',
310
- passed: false,
311
- expected: '',
312
- actual: '',
313
- error: e
314
- });
315
- }
316
-
317
- function complete() {
318
- self.result.status = self.status();
360
+ function complete(enabledAgain) {
361
+ self.result.status = self.status(enabledAgain);
319
362
  self.resultCallback(self.result);
320
363
 
321
364
  if (onComplete) {
@@ -324,16 +367,43 @@ getJasmineRequireObj().Spec = function(j$) {
324
367
  }
325
368
  };
326
369
 
370
+ Spec.prototype.onException = function onException(e) {
371
+ if (Spec.isPendingSpecException(e)) {
372
+ this.pend(extractCustomPendingMessage(e));
373
+ return;
374
+ }
375
+
376
+ if (e instanceof j$.errors.ExpectationFailed) {
377
+ return;
378
+ }
379
+
380
+ this.addExpectationResult(false, {
381
+ matcherName: '',
382
+ passed: false,
383
+ expected: '',
384
+ actual: '',
385
+ error: e
386
+ }, true);
387
+ };
388
+
327
389
  Spec.prototype.disable = function() {
328
390
  this.disabled = true;
329
391
  };
330
392
 
331
- Spec.prototype.pend = function() {
393
+ Spec.prototype.pend = function(message) {
332
394
  this.markedPending = true;
395
+ if (message) {
396
+ this.result.pendingReason = message;
397
+ }
333
398
  };
334
399
 
335
- Spec.prototype.status = function() {
336
- if (this.disabled) {
400
+ Spec.prototype.getResult = function() {
401
+ this.result.status = this.status();
402
+ return this.result;
403
+ };
404
+
405
+ Spec.prototype.status = function(enabled) {
406
+ if (this.disabled || enabled === false) {
337
407
  return 'disabled';
338
408
  }
339
409
 
@@ -348,10 +418,22 @@ getJasmineRequireObj().Spec = function(j$) {
348
418
  }
349
419
  };
350
420
 
421
+ Spec.prototype.isExecutable = function() {
422
+ return !this.disabled;
423
+ };
424
+
351
425
  Spec.prototype.getFullName = function() {
352
426
  return this.getSpecName(this);
353
427
  };
354
428
 
429
+ var extractCustomPendingMessage = function(e) {
430
+ var fullMessage = e.toString(),
431
+ boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
432
+ boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length;
433
+
434
+ return fullMessage.substr(boilerplateEnd);
435
+ };
436
+
355
437
  Spec.pendingSpecExceptionMessage = '=> marked Pending';
356
438
 
357
439
  Spec.isPendingSpecException = function(e) {
@@ -378,14 +460,23 @@ getJasmineRequireObj().Env = function(j$) {
378
460
 
379
461
  var realSetTimeout = j$.getGlobal().setTimeout;
380
462
  var realClearTimeout = j$.getGlobal().clearTimeout;
381
- this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler(), new j$.MockDate(global));
463
+ this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
382
464
 
383
465
  var runnableLookupTable = {};
384
-
385
- var spies = [];
466
+ var runnableResources = {};
386
467
 
387
468
  var currentSpec = null;
388
- var currentSuite = null;
469
+ var currentlyExecutingSuites = [];
470
+ var currentDeclarationSuite = null;
471
+ var throwOnExpectationFailure = false;
472
+
473
+ var currentSuite = function() {
474
+ return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
475
+ };
476
+
477
+ var currentRunnable = function() {
478
+ return currentSpec || currentSuite();
479
+ };
389
480
 
390
481
  var reporter = new j$.ReportDispatcher([
391
482
  'jasmineStarted',
@@ -400,11 +491,21 @@ getJasmineRequireObj().Env = function(j$) {
400
491
  return true;
401
492
  };
402
493
 
403
- var equalityTesters = [];
404
-
405
- var customEqualityTesters = [];
406
494
  this.addCustomEqualityTester = function(tester) {
407
- customEqualityTesters.push(tester);
495
+ if(!currentRunnable()) {
496
+ throw new Error('Custom Equalities must be added in a before function or a spec');
497
+ }
498
+ runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
499
+ };
500
+
501
+ this.addMatchers = function(matchersToAdd) {
502
+ if(!currentRunnable()) {
503
+ throw new Error('Matchers must be added in a before function or a spec');
504
+ }
505
+ var customMatchers = runnableResources[currentRunnable().id].customMatchers;
506
+ for (var matcherName in matchersToAdd) {
507
+ customMatchers[matcherName] = matchersToAdd[matcherName];
508
+ }
408
509
  };
409
510
 
410
511
  j$.Expectation.addCoreMatchers(j$.matchers);
@@ -422,7 +523,8 @@ getJasmineRequireObj().Env = function(j$) {
422
523
  var expectationFactory = function(actual, spec) {
423
524
  return j$.Expectation.Factory({
424
525
  util: j$.matchersUtil,
425
- customEqualityTesters: customEqualityTesters,
526
+ customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
527
+ customMatchers: runnableResources[spec.id].customMatchers,
426
528
  actual: actual,
427
529
  addExpectationResult: addExpectationResult
428
530
  });
@@ -432,30 +534,38 @@ getJasmineRequireObj().Env = function(j$) {
432
534
  }
433
535
  };
434
536
 
435
- var specStarted = function(spec) {
436
- currentSpec = spec;
437
- reporter.specStarted(spec.result);
537
+ var defaultResourcesForRunnable = function(id, parentRunnableId) {
538
+ var resources = {spies: [], customEqualityTesters: [], customMatchers: {}};
539
+
540
+ if(runnableResources[parentRunnableId]){
541
+ resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
542
+ resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
543
+ }
544
+
545
+ runnableResources[id] = resources;
438
546
  };
439
547
 
440
- var beforeFns = function(suite) {
441
- return function() {
442
- var befores = [];
443
- while(suite) {
444
- befores = befores.concat(suite.beforeFns);
445
- suite = suite.parentSuite;
446
- }
447
- return befores.reverse();
448
- };
548
+ var clearResourcesForRunnable = function(id) {
549
+ spyRegistry.clearSpies();
550
+ delete runnableResources[id];
449
551
  };
450
552
 
451
- var afterFns = function(suite) {
553
+ var beforeAndAfterFns = function(suite) {
452
554
  return function() {
453
- var afters = [];
555
+ var befores = [],
556
+ afters = [];
557
+
454
558
  while(suite) {
559
+ befores = befores.concat(suite.beforeFns);
455
560
  afters = afters.concat(suite.afterFns);
561
+
456
562
  suite = suite.parentSuite;
457
563
  }
458
- return afters;
564
+
565
+ return {
566
+ befores: befores.reverse(),
567
+ afters: afters
568
+ };
459
569
  };
460
570
  };
461
571
 
@@ -500,10 +610,19 @@ getJasmineRequireObj().Env = function(j$) {
500
610
  return j$.Spec.isPendingSpecException(e) || catchExceptions;
501
611
  };
502
612
 
613
+ this.throwOnExpectationFailure = function(value) {
614
+ throwOnExpectationFailure = !!value;
615
+ };
616
+
617
+ this.throwingExpectationFailures = function() {
618
+ return throwOnExpectationFailure;
619
+ };
620
+
503
621
  var queueRunnerFactory = function(options) {
504
622
  options.catchException = catchException;
505
623
  options.clearStack = options.clearStack || clearStack;
506
- options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
624
+ options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
625
+ options.fail = self.fail;
507
626
 
508
627
  new j$.QueueRunner(options).execute();
509
628
  };
@@ -512,66 +631,66 @@ getJasmineRequireObj().Env = function(j$) {
512
631
  env: this,
513
632
  id: getNextSuiteId(),
514
633
  description: 'Jasmine__TopLevel__Suite',
515
- queueRunner: queueRunnerFactory,
516
- resultCallback: function() {} // TODO - hook this up
634
+ queueRunner: queueRunnerFactory
517
635
  });
518
636
  runnableLookupTable[topSuite.id] = topSuite;
519
- currentSuite = topSuite;
637
+ defaultResourcesForRunnable(topSuite.id);
638
+ currentDeclarationSuite = topSuite;
520
639
 
521
640
  this.topSuite = function() {
522
641
  return topSuite;
523
642
  };
524
643
 
525
644
  this.execute = function(runnablesToRun) {
526
- runnablesToRun = runnablesToRun || [topSuite.id];
645
+ if(!runnablesToRun) {
646
+ if (focusedRunnables.length) {
647
+ runnablesToRun = focusedRunnables;
648
+ } else {
649
+ runnablesToRun = [topSuite.id];
650
+ }
651
+ }
652
+ var processor = new j$.TreeProcessor({
653
+ tree: topSuite,
654
+ runnableIds: runnablesToRun,
655
+ queueRunnerFactory: queueRunnerFactory,
656
+ nodeStart: function(suite) {
657
+ currentlyExecutingSuites.push(suite);
658
+ defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
659
+ reporter.suiteStarted(suite.result);
660
+ },
661
+ nodeComplete: function(suite, result) {
662
+ if (!suite.disabled) {
663
+ clearResourcesForRunnable(suite.id);
664
+ }
665
+ currentlyExecutingSuites.pop();
666
+ reporter.suiteDone(result);
667
+ }
668
+ });
527
669
 
528
- var allFns = [];
529
- for(var i = 0; i < runnablesToRun.length; i++) {
530
- var runnable = runnableLookupTable[runnablesToRun[i]];
531
- allFns.push((function(runnable) { return function(done) { runnable.execute(done); }; })(runnable));
670
+ if(!processor.processTree().valid) {
671
+ throw new Error('Invalid order: would cause a beforeAll or afterAll to be run multiple times');
532
672
  }
533
673
 
534
674
  reporter.jasmineStarted({
535
675
  totalSpecsDefined: totalSpecsDefined
536
676
  });
537
677
 
538
- queueRunnerFactory({fns: allFns, onComplete: reporter.jasmineDone});
678
+ processor.execute(reporter.jasmineDone);
539
679
  };
540
680
 
541
681
  this.addReporter = function(reporterToAdd) {
542
682
  reporter.addReporter(reporterToAdd);
543
683
  };
544
684
 
545
- this.addMatchers = function(matchersToAdd) {
546
- j$.Expectation.addMatchers(matchersToAdd);
547
- };
548
-
549
- this.spyOn = function(obj, methodName) {
550
- if (j$.util.isUndefined(obj)) {
551
- throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()');
552
- }
553
-
554
- if (j$.util.isUndefined(obj[methodName])) {
555
- throw new Error(methodName + '() method does not exist');
556
- }
557
-
558
- if (obj[methodName] && j$.isSpy(obj[methodName])) {
559
- //TODO?: should this return the current spy? Downside: may cause user confusion about spy state
560
- throw new Error(methodName + ' has already been spied upon');
685
+ var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
686
+ if(!currentRunnable()) {
687
+ throw new Error('Spies must be created in a before function or a spec');
561
688
  }
689
+ return runnableResources[currentRunnable().id].spies;
690
+ }});
562
691
 
563
- var spy = j$.createSpy(methodName, obj[methodName]);
564
-
565
- spies.push({
566
- spy: spy,
567
- baseObj: obj,
568
- methodName: methodName,
569
- originalValue: obj[methodName]
570
- });
571
-
572
- obj[methodName] = spy;
573
-
574
- return spy;
692
+ this.spyOn = function() {
693
+ return spyRegistry.spyOn.apply(spyRegistry, arguments);
575
694
  };
576
695
 
577
696
  var suiteFactory = function(description) {
@@ -579,12 +698,10 @@ getJasmineRequireObj().Env = function(j$) {
579
698
  env: self,
580
699
  id: getNextSuiteId(),
581
700
  description: description,
582
- parentSuite: currentSuite,
583
- queueRunner: queueRunnerFactory,
584
- onStart: suiteStarted,
585
- resultCallback: function(attrs) {
586
- reporter.suiteDone(attrs);
587
- }
701
+ parentSuite: currentDeclarationSuite,
702
+ expectationFactory: expectationFactory,
703
+ expectationResultFactory: expectationResultFactory,
704
+ throwOnExpectationFailure: throwOnExpectationFailure
588
705
  });
589
706
 
590
707
  runnableLookupTable[suite.id] = suite;
@@ -593,10 +710,33 @@ getJasmineRequireObj().Env = function(j$) {
593
710
 
594
711
  this.describe = function(description, specDefinitions) {
595
712
  var suite = suiteFactory(description);
713
+ addSpecsToSuite(suite, specDefinitions);
714
+ return suite;
715
+ };
716
+
717
+ this.xdescribe = function(description, specDefinitions) {
718
+ var suite = this.describe(description, specDefinitions);
719
+ suite.disable();
720
+ return suite;
721
+ };
722
+
723
+ var focusedRunnables = [];
724
+
725
+ this.fdescribe = function(description, specDefinitions) {
726
+ var suite = suiteFactory(description);
727
+ suite.isFocused = true;
728
+
729
+ focusedRunnables.push(suite.id);
730
+ unfocusAncestor();
731
+ addSpecsToSuite(suite, specDefinitions);
732
+
733
+ return suite;
734
+ };
596
735
 
597
- var parentSuite = currentSuite;
736
+ function addSpecsToSuite(suite, specDefinitions) {
737
+ var parentSuite = currentDeclarationSuite;
598
738
  parentSuite.addChild(suite);
599
- currentSuite = suite;
739
+ currentDeclarationSuite = suite;
600
740
 
601
741
  var declarationError = null;
602
742
  try {
@@ -606,31 +746,43 @@ getJasmineRequireObj().Env = function(j$) {
606
746
  }
607
747
 
608
748
  if (declarationError) {
609
- this.it('encountered a declaration exception', function() {
749
+ self.it('encountered a declaration exception', function() {
610
750
  throw declarationError;
611
751
  });
612
752
  }
613
753
 
614
- currentSuite = parentSuite;
754
+ currentDeclarationSuite = parentSuite;
755
+ }
615
756
 
616
- return suite;
617
- };
757
+ function findFocusedAncestor(suite) {
758
+ while (suite) {
759
+ if (suite.isFocused) {
760
+ return suite.id;
761
+ }
762
+ suite = suite.parentSuite;
763
+ }
618
764
 
619
- this.xdescribe = function(description, specDefinitions) {
620
- var suite = this.describe(description, specDefinitions);
621
- suite.disable();
622
- return suite;
623
- };
765
+ return null;
766
+ }
624
767
 
625
- var specFactory = function(description, fn, suite) {
626
- totalSpecsDefined++;
768
+ function unfocusAncestor() {
769
+ var focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
770
+ if (focusedAncestor) {
771
+ for (var i = 0; i < focusedRunnables.length; i++) {
772
+ if (focusedRunnables[i] === focusedAncestor) {
773
+ focusedRunnables.splice(i, 1);
774
+ break;
775
+ }
776
+ }
777
+ }
778
+ }
627
779
 
780
+ var specFactory = function(description, fn, suite, timeout) {
781
+ totalSpecsDefined++;
628
782
  var spec = new j$.Spec({
629
783
  id: getNextSpecId(),
630
- beforeFns: beforeFns(suite),
631
- afterFns: afterFns(suite),
784
+ beforeAndAfterFns: beforeAndAfterFns(suite),
632
785
  expectationFactory: expectationFactory,
633
- exceptionFormatter: exceptionFormatter,
634
786
  resultCallback: specResultCallback,
635
787
  getSpecName: function(spec) {
636
788
  return getSpecName(spec, suite);
@@ -639,7 +791,12 @@ getJasmineRequireObj().Env = function(j$) {
639
791
  description: description,
640
792
  expectationResultFactory: expectationResultFactory,
641
793
  queueRunnerFactory: queueRunnerFactory,
642
- fn: fn
794
+ userContext: function() { return suite.clonedSharedUserContext(); },
795
+ queueableFn: {
796
+ fn: fn,
797
+ timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
798
+ },
799
+ throwOnExpectationFailure: throwOnExpectationFailure
643
800
  });
644
801
 
645
802
  runnableLookupTable[spec.id] = spec;
@@ -650,57 +807,98 @@ getJasmineRequireObj().Env = function(j$) {
650
807
 
651
808
  return spec;
652
809
 
653
- function removeAllSpies() {
654
- for (var i = 0; i < spies.length; i++) {
655
- var spyEntry = spies[i];
656
- spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue;
657
- }
658
- spies = [];
659
- }
660
-
661
810
  function specResultCallback(result) {
662
- removeAllSpies();
663
- j$.Expectation.resetMatchers();
664
- customEqualityTesters = [];
811
+ clearResourcesForRunnable(spec.id);
665
812
  currentSpec = null;
666
813
  reporter.specDone(result);
667
814
  }
668
- };
669
815
 
670
- var suiteStarted = function(suite) {
671
- reporter.suiteStarted(suite.result);
816
+ function specStarted(spec) {
817
+ currentSpec = spec;
818
+ defaultResourcesForRunnable(spec.id, suite.id);
819
+ reporter.specStarted(spec.result);
820
+ }
672
821
  };
673
822
 
674
- this.it = function(description, fn) {
675
- var spec = specFactory(description, fn, currentSuite);
676
- currentSuite.addChild(spec);
823
+ this.it = function(description, fn, timeout) {
824
+ var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
825
+ currentDeclarationSuite.addChild(spec);
677
826
  return spec;
678
827
  };
679
828
 
680
- this.xit = function(description, fn) {
681
- var spec = this.it(description, fn);
829
+ this.xit = function() {
830
+ var spec = this.it.apply(this, arguments);
682
831
  spec.pend();
683
832
  return spec;
684
833
  };
685
834
 
835
+ this.fit = function(){
836
+ var spec = this.it.apply(this, arguments);
837
+
838
+ focusedRunnables.push(spec.id);
839
+ unfocusAncestor();
840
+ return spec;
841
+ };
842
+
686
843
  this.expect = function(actual) {
687
- if (!currentSpec) {
844
+ if (!currentRunnable()) {
688
845
  throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
689
846
  }
690
847
 
691
- return currentSpec.expect(actual);
848
+ return currentRunnable().expect(actual);
692
849
  };
693
850
 
694
- this.beforeEach = function(beforeEachFunction) {
695
- currentSuite.beforeEach(beforeEachFunction);
851
+ this.beforeEach = function(beforeEachFunction, timeout) {
852
+ currentDeclarationSuite.beforeEach({
853
+ fn: beforeEachFunction,
854
+ timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
855
+ });
856
+ };
857
+
858
+ this.beforeAll = function(beforeAllFunction, timeout) {
859
+ currentDeclarationSuite.beforeAll({
860
+ fn: beforeAllFunction,
861
+ timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
862
+ });
863
+ };
864
+
865
+ this.afterEach = function(afterEachFunction, timeout) {
866
+ currentDeclarationSuite.afterEach({
867
+ fn: afterEachFunction,
868
+ timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
869
+ });
870
+ };
871
+
872
+ this.afterAll = function(afterAllFunction, timeout) {
873
+ currentDeclarationSuite.afterAll({
874
+ fn: afterAllFunction,
875
+ timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
876
+ });
696
877
  };
697
878
 
698
- this.afterEach = function(afterEachFunction) {
699
- currentSuite.afterEach(afterEachFunction);
879
+ this.pending = function(message) {
880
+ var fullMessage = j$.Spec.pendingSpecExceptionMessage;
881
+ if(message) {
882
+ fullMessage += message;
883
+ }
884
+ throw fullMessage;
700
885
  };
701
886
 
702
- this.pending = function() {
703
- throw j$.Spec.pendingSpecExceptionMessage;
887
+ this.fail = function(error) {
888
+ var message = 'Failed';
889
+ if (error) {
890
+ message += ': ';
891
+ message += error.message || error;
892
+ }
893
+
894
+ currentRunnable().addExpectationResult(false, {
895
+ matcherName: '',
896
+ passed: false,
897
+ expected: '',
898
+ actual: '',
899
+ message: message,
900
+ error: error && error.message ? error : null
901
+ });
704
902
  };
705
903
  }
706
904
 
@@ -739,26 +937,31 @@ getJasmineRequireObj().JsApiReporter = function() {
739
937
  return status;
740
938
  };
741
939
 
742
- var suites = {};
940
+ var suites = [],
941
+ suites_hash = {};
743
942
 
744
943
  this.suiteStarted = function(result) {
745
- storeSuite(result);
944
+ suites_hash[result.id] = result;
746
945
  };
747
946
 
748
947
  this.suiteDone = function(result) {
749
948
  storeSuite(result);
750
949
  };
751
950
 
951
+ this.suiteResults = function(index, length) {
952
+ return suites.slice(index, index + length);
953
+ };
954
+
752
955
  function storeSuite(result) {
753
- suites[result.id] = result;
956
+ suites.push(result);
957
+ suites_hash[result.id] = result;
754
958
  }
755
959
 
756
960
  this.suites = function() {
757
- return suites;
961
+ return suites_hash;
758
962
  };
759
963
 
760
964
  var specs = [];
761
- this.specStarted = function(result) { };
762
965
 
763
966
  this.specDone = function(result) {
764
967
  specs.push(result);
@@ -781,59 +984,22 @@ getJasmineRequireObj().JsApiReporter = function() {
781
984
  return JsApiReporter;
782
985
  };
783
986
 
784
- getJasmineRequireObj().Any = function() {
987
+ getJasmineRequireObj().CallTracker = function() {
785
988
 
786
- function Any(expectedObject) {
787
- this.expectedObject = expectedObject;
788
- }
989
+ function CallTracker() {
990
+ var calls = [];
789
991
 
790
- Any.prototype.jasmineMatches = function(other) {
791
- if (this.expectedObject == String) {
792
- return typeof other == 'string' || other instanceof String;
793
- }
992
+ this.track = function(context) {
993
+ calls.push(context);
994
+ };
794
995
 
795
- if (this.expectedObject == Number) {
796
- return typeof other == 'number' || other instanceof Number;
797
- }
996
+ this.any = function() {
997
+ return !!calls.length;
998
+ };
798
999
 
799
- if (this.expectedObject == Function) {
800
- return typeof other == 'function' || other instanceof Function;
801
- }
802
-
803
- if (this.expectedObject == Object) {
804
- return typeof other == 'object';
805
- }
806
-
807
- if (this.expectedObject == Boolean) {
808
- return typeof other == 'boolean';
809
- }
810
-
811
- return other instanceof this.expectedObject;
812
- };
813
-
814
- Any.prototype.jasmineToString = function() {
815
- return '<jasmine.any(' + this.expectedObject + ')>';
816
- };
817
-
818
- return Any;
819
- };
820
-
821
- getJasmineRequireObj().CallTracker = function() {
822
-
823
- function CallTracker() {
824
- var calls = [];
825
-
826
- this.track = function(context) {
827
- calls.push(context);
828
- };
829
-
830
- this.any = function() {
831
- return !!calls.length;
832
- };
833
-
834
- this.count = function() {
835
- return calls.length;
836
- };
1000
+ this.count = function() {
1001
+ return calls.length;
1002
+ };
837
1003
 
838
1004
  this.argsFor = function(index) {
839
1005
  var call = calls[index];
@@ -870,7 +1036,7 @@ getJasmineRequireObj().CallTracker = function() {
870
1036
  };
871
1037
 
872
1038
  getJasmineRequireObj().Clock = function() {
873
- function Clock(global, delayedFunctionScheduler, mockDate) {
1039
+ function Clock(global, delayedFunctionSchedulerFactory, mockDate) {
874
1040
  var self = this,
875
1041
  realTimingFunctions = {
876
1042
  setTimeout: global.setTimeout,
@@ -885,19 +1051,24 @@ getJasmineRequireObj().Clock = function() {
885
1051
  clearInterval: clearInterval
886
1052
  },
887
1053
  installed = false,
1054
+ delayedFunctionScheduler,
888
1055
  timer;
889
1056
 
890
1057
 
891
1058
  self.install = function() {
1059
+ if(!originalTimingFunctionsIntact()) {
1060
+ throw new Error('Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?');
1061
+ }
892
1062
  replace(global, fakeTimingFunctions);
893
1063
  timer = fakeTimingFunctions;
1064
+ delayedFunctionScheduler = delayedFunctionSchedulerFactory();
894
1065
  installed = true;
895
1066
 
896
1067
  return self;
897
1068
  };
898
1069
 
899
1070
  self.uninstall = function() {
900
- delayedFunctionScheduler.reset();
1071
+ delayedFunctionScheduler = null;
901
1072
  mockDate.uninstall();
902
1073
  replace(global, realTimingFunctions);
903
1074
 
@@ -905,6 +1076,15 @@ getJasmineRequireObj().Clock = function() {
905
1076
  installed = false;
906
1077
  };
907
1078
 
1079
+ self.withMock = function(closure) {
1080
+ this.install();
1081
+ try {
1082
+ closure();
1083
+ } finally {
1084
+ this.uninstall();
1085
+ }
1086
+ };
1087
+
908
1088
  self.mockDate = function(initialDate) {
909
1089
  mockDate.install(initialDate);
910
1090
  };
@@ -948,6 +1128,13 @@ getJasmineRequireObj().Clock = function() {
948
1128
 
949
1129
  return self;
950
1130
 
1131
+ function originalTimingFunctionsIntact() {
1132
+ return global.setTimeout === realTimingFunctions.setTimeout &&
1133
+ global.clearTimeout === realTimingFunctions.clearTimeout &&
1134
+ global.setInterval === realTimingFunctions.setInterval &&
1135
+ global.clearInterval === realTimingFunctions.clearInterval;
1136
+ }
1137
+
951
1138
  function legacyIE() {
952
1139
  //if these methods are polyfilled, apply will be present
953
1140
  return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
@@ -1057,13 +1244,6 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
1057
1244
  }
1058
1245
  };
1059
1246
 
1060
- self.reset = function() {
1061
- currentTime = 0;
1062
- scheduledLookup = [];
1063
- scheduledFunctions = {};
1064
- delayedFnCount = 0;
1065
- };
1066
-
1067
1247
  return self;
1068
1248
 
1069
1249
  function indexOfFirstToPass(array, testFn) {
@@ -1099,6 +1279,12 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
1099
1279
  scheduledFn.runAtMillis + scheduledFn.millis);
1100
1280
  }
1101
1281
 
1282
+ function forEachFunction(funcsToRun, callback) {
1283
+ for (var i = 0; i < funcsToRun.length; ++i) {
1284
+ callback(funcsToRun[i]);
1285
+ }
1286
+ }
1287
+
1102
1288
  function runScheduledFunctions(endTime) {
1103
1289
  if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
1104
1290
  return;
@@ -1110,14 +1296,15 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
1110
1296
  var funcsToRun = scheduledFunctions[currentTime];
1111
1297
  delete scheduledFunctions[currentTime];
1112
1298
 
1113
- for (var i = 0; i < funcsToRun.length; ++i) {
1114
- var funcToRun = funcsToRun[i];
1115
- funcToRun.funcToCall.apply(null, funcToRun.params || []);
1116
-
1299
+ forEachFunction(funcsToRun, function(funcToRun) {
1117
1300
  if (funcToRun.recurring) {
1118
1301
  reschedule(funcToRun);
1119
1302
  }
1120
- }
1303
+ });
1304
+
1305
+ forEachFunction(funcsToRun, function(funcToRun) {
1306
+ funcToRun.funcToCall.apply(null, funcToRun.params || []);
1307
+ });
1121
1308
  } while (scheduledLookup.length > 0 &&
1122
1309
  // checking first if we're out of time prevents setTimeout(0)
1123
1310
  // scheduled in a funcToRun from forcing an extra iteration
@@ -1161,8 +1348,6 @@ getJasmineRequireObj().ExceptionFormatter = function() {
1161
1348
 
1162
1349
  getJasmineRequireObj().Expectation = function() {
1163
1350
 
1164
- var matchers = {};
1165
-
1166
1351
  function Expectation(options) {
1167
1352
  this.util = options.util || { buildFailureMessage: function() {} };
1168
1353
  this.customEqualityTesters = options.customEqualityTesters || [];
@@ -1170,8 +1355,9 @@ getJasmineRequireObj().Expectation = function() {
1170
1355
  this.addExpectationResult = options.addExpectationResult || function(){};
1171
1356
  this.isNot = options.isNot;
1172
1357
 
1173
- for (var matcherName in matchers) {
1174
- this[matcherName] = matchers[matcherName];
1358
+ var customMatchers = options.customMatchers || {};
1359
+ for (var matcherName in customMatchers) {
1360
+ this[matcherName] = Expectation.prototype.wrapCompare(matcherName, customMatchers[matcherName]);
1175
1361
  }
1176
1362
  }
1177
1363
 
@@ -1238,19 +1424,6 @@ getJasmineRequireObj().Expectation = function() {
1238
1424
  }
1239
1425
  };
1240
1426
 
1241
- Expectation.addMatchers = function(matchersToAdd) {
1242
- for (var name in matchersToAdd) {
1243
- var matcher = matchersToAdd[name];
1244
- matchers[name] = Expectation.prototype.wrapCompare(name, matcher);
1245
- }
1246
- };
1247
-
1248
- Expectation.resetMatchers = function() {
1249
- for (var name in matchers) {
1250
- delete matchers[name];
1251
- }
1252
- };
1253
-
1254
1427
  Expectation.Factory = function(options) {
1255
1428
  options = options || {};
1256
1429
 
@@ -1273,15 +1446,20 @@ getJasmineRequireObj().buildExpectationResult = function() {
1273
1446
  var messageFormatter = options.messageFormatter || function() {},
1274
1447
  stackFormatter = options.stackFormatter || function() {};
1275
1448
 
1276
- return {
1449
+ var result = {
1277
1450
  matcherName: options.matcherName,
1278
- expected: options.expected,
1279
- actual: options.actual,
1280
1451
  message: message(),
1281
1452
  stack: stack(),
1282
1453
  passed: options.passed
1283
1454
  };
1284
1455
 
1456
+ if(!result.passed) {
1457
+ result.expected = options.expected;
1458
+ result.actual = options.actual;
1459
+ }
1460
+
1461
+ return result;
1462
+
1285
1463
  function message() {
1286
1464
  if (options.passed) {
1287
1465
  return 'Passed.';
@@ -1369,13 +1547,14 @@ getJasmineRequireObj().MockDate = function() {
1369
1547
  case 6:
1370
1548
  return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
1371
1549
  arguments[4], arguments[5]);
1372
- case 7:
1550
+ default:
1373
1551
  return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
1374
1552
  arguments[4], arguments[5], arguments[6]);
1375
1553
  }
1376
1554
  }
1377
1555
 
1378
1556
  function createDateProperties() {
1557
+ FakeDate.prototype = GlobalDate.prototype;
1379
1558
 
1380
1559
  FakeDate.now = function() {
1381
1560
  if (GlobalDate.now) {
@@ -1395,41 +1574,6 @@ getJasmineRequireObj().MockDate = function() {
1395
1574
  return MockDate;
1396
1575
  };
1397
1576
 
1398
- getJasmineRequireObj().ObjectContaining = function(j$) {
1399
-
1400
- function ObjectContaining(sample) {
1401
- this.sample = sample;
1402
- }
1403
-
1404
- ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
1405
- if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
1406
-
1407
- mismatchKeys = mismatchKeys || [];
1408
- mismatchValues = mismatchValues || [];
1409
-
1410
- var hasKey = function(obj, keyName) {
1411
- return obj !== null && !j$.util.isUndefined(obj[keyName]);
1412
- };
1413
-
1414
- for (var property in this.sample) {
1415
- if (!hasKey(other, property) && hasKey(this.sample, property)) {
1416
- mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.');
1417
- }
1418
- else if (!j$.matchersUtil.equals(other[property], this.sample[property])) {
1419
- mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.');
1420
- }
1421
- }
1422
-
1423
- return (mismatchKeys.length === 0 && mismatchValues.length === 0);
1424
- };
1425
-
1426
- ObjectContaining.prototype.jasmineToString = function() {
1427
- return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
1428
- };
1429
-
1430
- return ObjectContaining;
1431
- };
1432
-
1433
1577
  getJasmineRequireObj().pp = function(j$) {
1434
1578
 
1435
1579
  function PrettyPrinter() {
@@ -1525,17 +1669,36 @@ getJasmineRequireObj().pp = function(j$) {
1525
1669
  if(array.length > length){
1526
1670
  this.append(', ...');
1527
1671
  }
1672
+
1673
+ var self = this;
1674
+ var first = array.length === 0;
1675
+ this.iterateObject(array, function(property, isGetter) {
1676
+ if (property.match(/^\d+$/)) {
1677
+ return;
1678
+ }
1679
+
1680
+ if (first) {
1681
+ first = false;
1682
+ } else {
1683
+ self.append(', ');
1684
+ }
1685
+
1686
+ self.formatProperty(array, property, isGetter);
1687
+ });
1688
+
1528
1689
  this.append(' ]');
1529
1690
  };
1530
1691
 
1531
1692
  StringPrettyPrinter.prototype.emitObject = function(obj) {
1693
+ var constructorName = obj.constructor ? j$.fnNameFor(obj.constructor) : 'null';
1694
+ this.append(constructorName);
1695
+
1532
1696
  if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
1533
- this.append('Object');
1534
1697
  return;
1535
1698
  }
1536
1699
 
1537
1700
  var self = this;
1538
- this.append('{ ');
1701
+ this.append('({ ');
1539
1702
  var first = true;
1540
1703
 
1541
1704
  this.iterateObject(obj, function(property, isGetter) {
@@ -1545,16 +1708,20 @@ getJasmineRequireObj().pp = function(j$) {
1545
1708
  self.append(', ');
1546
1709
  }
1547
1710
 
1548
- self.append(property);
1549
- self.append(': ');
1711
+ self.formatProperty(obj, property, isGetter);
1712
+ });
1713
+
1714
+ this.append(' })');
1715
+ };
1716
+
1717
+ StringPrettyPrinter.prototype.formatProperty = function(obj, property, isGetter) {
1718
+ this.append(property);
1719
+ this.append(': ');
1550
1720
  if (isGetter) {
1551
- self.append('<getter>');
1721
+ this.append('<getter>');
1552
1722
  } else {
1553
- self.format(obj[property]);
1723
+ this.format(obj[property]);
1554
1724
  }
1555
- });
1556
-
1557
- this.append(' }');
1558
1725
  };
1559
1726
 
1560
1727
  StringPrettyPrinter.prototype.append = function(value) {
@@ -1581,31 +1748,33 @@ getJasmineRequireObj().QueueRunner = function(j$) {
1581
1748
  }
1582
1749
 
1583
1750
  function QueueRunner(attrs) {
1584
- this.fns = attrs.fns || [];
1751
+ this.queueableFns = attrs.queueableFns || [];
1585
1752
  this.onComplete = attrs.onComplete || function() {};
1586
1753
  this.clearStack = attrs.clearStack || function(fn) {fn();};
1587
1754
  this.onException = attrs.onException || function() {};
1588
1755
  this.catchException = attrs.catchException || function() { return true; };
1589
- this.enforceTimeout = attrs.enforceTimeout || function() { return false; };
1590
- this.userContext = {};
1591
- this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
1756
+ this.userContext = attrs.userContext || {};
1757
+ this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
1758
+ this.fail = attrs.fail || function() {};
1592
1759
  }
1593
1760
 
1594
1761
  QueueRunner.prototype.execute = function() {
1595
- this.run(this.fns, 0);
1762
+ this.run(this.queueableFns, 0);
1596
1763
  };
1597
1764
 
1598
- QueueRunner.prototype.run = function(fns, recursiveIndex) {
1599
- var length = fns.length,
1600
- self = this,
1601
- iterativeIndex;
1765
+ QueueRunner.prototype.run = function(queueableFns, recursiveIndex) {
1766
+ var length = queueableFns.length,
1767
+ self = this,
1768
+ iterativeIndex;
1769
+
1602
1770
 
1603
1771
  for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
1604
- var fn = fns[iterativeIndex];
1605
- if (fn.length > 0) {
1606
- return attemptAsync(fn);
1772
+ var queueableFn = queueableFns[iterativeIndex];
1773
+ if (queueableFn.fn.length > 0) {
1774
+ attemptAsync(queueableFn);
1775
+ return;
1607
1776
  } else {
1608
- attemptSync(fn);
1777
+ attemptSync(queueableFn);
1609
1778
  }
1610
1779
  }
1611
1780
 
@@ -1615,41 +1784,51 @@ getJasmineRequireObj().QueueRunner = function(j$) {
1615
1784
  this.clearStack(this.onComplete);
1616
1785
  }
1617
1786
 
1618
- function attemptSync(fn) {
1787
+ function attemptSync(queueableFn) {
1619
1788
  try {
1620
- fn.call(self.userContext);
1789
+ queueableFn.fn.call(self.userContext);
1621
1790
  } catch (e) {
1622
- handleException(e);
1791
+ handleException(e, queueableFn);
1623
1792
  }
1624
1793
  }
1625
1794
 
1626
- function attemptAsync(fn) {
1795
+ function attemptAsync(queueableFn) {
1627
1796
  var clearTimeout = function () {
1628
- Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeoutId]]);
1797
+ Function.prototype.apply.apply(self.timeout.clearTimeout, [j$.getGlobal(), [timeoutId]]);
1629
1798
  },
1630
1799
  next = once(function () {
1631
1800
  clearTimeout(timeoutId);
1632
- self.run(fns, iterativeIndex + 1);
1801
+ self.run(queueableFns, iterativeIndex + 1);
1633
1802
  }),
1634
1803
  timeoutId;
1635
1804
 
1636
- if (self.enforceTimeout()) {
1637
- timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
1638
- self.onException(new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.'));
1805
+ next.fail = function() {
1806
+ self.fail.apply(null, arguments);
1807
+ next();
1808
+ };
1809
+
1810
+ if (queueableFn.timeout) {
1811
+ timeoutId = Function.prototype.apply.apply(self.timeout.setTimeout, [j$.getGlobal(), [function() {
1812
+ var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
1813
+ onException(error, queueableFn);
1639
1814
  next();
1640
- }, j$.DEFAULT_TIMEOUT_INTERVAL]]);
1815
+ }, queueableFn.timeout()]]);
1641
1816
  }
1642
1817
 
1643
1818
  try {
1644
- fn.call(self.userContext, next);
1819
+ queueableFn.fn.call(self.userContext, next);
1645
1820
  } catch (e) {
1646
- handleException(e);
1821
+ handleException(e, queueableFn);
1647
1822
  next();
1648
1823
  }
1649
1824
  }
1650
1825
 
1651
- function handleException(e) {
1826
+ function onException(e, queueableFn) {
1652
1827
  self.onException(e);
1828
+ }
1829
+
1830
+ function handleException(e, queueableFn) {
1831
+ onException(e, queueableFn);
1653
1832
  if (!self.catchException(e)) {
1654
1833
  //TODO: set a var when we catch an exception and
1655
1834
  //use a finally block to close the loop in a nice way..
@@ -1697,174 +1876,670 @@ getJasmineRequireObj().ReportDispatcher = function() {
1697
1876
  };
1698
1877
 
1699
1878
 
1700
- getJasmineRequireObj().SpyStrategy = function() {
1879
+ getJasmineRequireObj().SpyRegistry = function(j$) {
1880
+
1881
+ function SpyRegistry(options) {
1882
+ options = options || {};
1883
+ var currentSpies = options.currentSpies || function() { return []; };
1884
+
1885
+ this.spyOn = function(obj, methodName) {
1886
+ if (j$.util.isUndefined(obj)) {
1887
+ throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()');
1888
+ }
1889
+
1890
+ if (j$.util.isUndefined(methodName)) {
1891
+ throw new Error('No method name supplied');
1892
+ }
1893
+
1894
+ if (j$.util.isUndefined(obj[methodName])) {
1895
+ throw new Error(methodName + '() method does not exist');
1896
+ }
1897
+
1898
+ if (obj[methodName] && j$.isSpy(obj[methodName])) {
1899
+ //TODO?: should this return the current spy? Downside: may cause user confusion about spy state
1900
+ throw new Error(methodName + ' has already been spied upon');
1901
+ }
1902
+
1903
+ var spy = j$.createSpy(methodName, obj[methodName]);
1904
+
1905
+ currentSpies().push({
1906
+ spy: spy,
1907
+ baseObj: obj,
1908
+ methodName: methodName,
1909
+ originalValue: obj[methodName]
1910
+ });
1911
+
1912
+ obj[methodName] = spy;
1913
+
1914
+ return spy;
1915
+ };
1916
+
1917
+ this.clearSpies = function() {
1918
+ var spies = currentSpies();
1919
+ for (var i = 0; i < spies.length; i++) {
1920
+ var spyEntry = spies[i];
1921
+ spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue;
1922
+ }
1923
+ };
1924
+ }
1925
+
1926
+ return SpyRegistry;
1927
+ };
1928
+
1929
+ getJasmineRequireObj().SpyStrategy = function() {
1930
+
1931
+ function SpyStrategy(options) {
1932
+ options = options || {};
1933
+
1934
+ var identity = options.name || 'unknown',
1935
+ originalFn = options.fn || function() {},
1936
+ getSpy = options.getSpy || function() {},
1937
+ plan = function() {};
1938
+
1939
+ this.identity = function() {
1940
+ return identity;
1941
+ };
1942
+
1943
+ this.exec = function() {
1944
+ return plan.apply(this, arguments);
1945
+ };
1946
+
1947
+ this.callThrough = function() {
1948
+ plan = originalFn;
1949
+ return getSpy();
1950
+ };
1951
+
1952
+ this.returnValue = function(value) {
1953
+ plan = function() {
1954
+ return value;
1955
+ };
1956
+ return getSpy();
1957
+ };
1958
+
1959
+ this.returnValues = function() {
1960
+ var values = Array.prototype.slice.call(arguments);
1961
+ plan = function () {
1962
+ return values.shift();
1963
+ };
1964
+ return getSpy();
1965
+ };
1966
+
1967
+ this.throwError = function(something) {
1968
+ var error = (something instanceof Error) ? something : new Error(something);
1969
+ plan = function() {
1970
+ throw error;
1971
+ };
1972
+ return getSpy();
1973
+ };
1974
+
1975
+ this.callFake = function(fn) {
1976
+ plan = fn;
1977
+ return getSpy();
1978
+ };
1979
+
1980
+ this.stub = function(fn) {
1981
+ plan = function() {};
1982
+ return getSpy();
1983
+ };
1984
+ }
1985
+
1986
+ return SpyStrategy;
1987
+ };
1988
+
1989
+ getJasmineRequireObj().Suite = function(j$) {
1990
+ function Suite(attrs) {
1991
+ this.env = attrs.env;
1992
+ this.id = attrs.id;
1993
+ this.parentSuite = attrs.parentSuite;
1994
+ this.description = attrs.description;
1995
+ this.expectationFactory = attrs.expectationFactory;
1996
+ this.expectationResultFactory = attrs.expectationResultFactory;
1997
+ this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure;
1998
+
1999
+ this.beforeFns = [];
2000
+ this.afterFns = [];
2001
+ this.beforeAllFns = [];
2002
+ this.afterAllFns = [];
2003
+ this.disabled = false;
2004
+
2005
+ this.children = [];
2006
+
2007
+ this.result = {
2008
+ id: this.id,
2009
+ description: this.description,
2010
+ fullName: this.getFullName(),
2011
+ failedExpectations: []
2012
+ };
2013
+ }
2014
+
2015
+ Suite.prototype.expect = function(actual) {
2016
+ return this.expectationFactory(actual, this);
2017
+ };
2018
+
2019
+ Suite.prototype.getFullName = function() {
2020
+ var fullName = this.description;
2021
+ for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
2022
+ if (parentSuite.parentSuite) {
2023
+ fullName = parentSuite.description + ' ' + fullName;
2024
+ }
2025
+ }
2026
+ return fullName;
2027
+ };
2028
+
2029
+ Suite.prototype.disable = function() {
2030
+ this.disabled = true;
2031
+ };
2032
+
2033
+ Suite.prototype.beforeEach = function(fn) {
2034
+ this.beforeFns.unshift(fn);
2035
+ };
2036
+
2037
+ Suite.prototype.beforeAll = function(fn) {
2038
+ this.beforeAllFns.push(fn);
2039
+ };
2040
+
2041
+ Suite.prototype.afterEach = function(fn) {
2042
+ this.afterFns.unshift(fn);
2043
+ };
2044
+
2045
+ Suite.prototype.afterAll = function(fn) {
2046
+ this.afterAllFns.push(fn);
2047
+ };
2048
+
2049
+ Suite.prototype.addChild = function(child) {
2050
+ this.children.push(child);
2051
+ };
2052
+
2053
+ Suite.prototype.status = function() {
2054
+ if (this.disabled) {
2055
+ return 'disabled';
2056
+ }
2057
+
2058
+ if (this.result.failedExpectations.length > 0) {
2059
+ return 'failed';
2060
+ } else {
2061
+ return 'finished';
2062
+ }
2063
+ };
2064
+
2065
+ Suite.prototype.isExecutable = function() {
2066
+ return !this.disabled;
2067
+ };
2068
+
2069
+ Suite.prototype.canBeReentered = function() {
2070
+ return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0;
2071
+ };
2072
+
2073
+ Suite.prototype.getResult = function() {
2074
+ this.result.status = this.status();
2075
+ return this.result;
2076
+ };
2077
+
2078
+ Suite.prototype.sharedUserContext = function() {
2079
+ if (!this.sharedContext) {
2080
+ this.sharedContext = this.parentSuite ? clone(this.parentSuite.sharedUserContext()) : {};
2081
+ }
2082
+
2083
+ return this.sharedContext;
2084
+ };
2085
+
2086
+ Suite.prototype.clonedSharedUserContext = function() {
2087
+ return clone(this.sharedUserContext());
2088
+ };
2089
+
2090
+ Suite.prototype.onException = function() {
2091
+ if (arguments[0] instanceof j$.errors.ExpectationFailed) {
2092
+ return;
2093
+ }
2094
+
2095
+ if(isAfterAll(this.children)) {
2096
+ var data = {
2097
+ matcherName: '',
2098
+ passed: false,
2099
+ expected: '',
2100
+ actual: '',
2101
+ error: arguments[0]
2102
+ };
2103
+ this.result.failedExpectations.push(this.expectationResultFactory(data));
2104
+ } else {
2105
+ for (var i = 0; i < this.children.length; i++) {
2106
+ var child = this.children[i];
2107
+ child.onException.apply(child, arguments);
2108
+ }
2109
+ }
2110
+ };
2111
+
2112
+ Suite.prototype.addExpectationResult = function () {
2113
+ if(isAfterAll(this.children) && isFailure(arguments)){
2114
+ var data = arguments[1];
2115
+ this.result.failedExpectations.push(this.expectationResultFactory(data));
2116
+ if(this.throwOnExpectationFailure) {
2117
+ throw new j$.errors.ExpectationFailed();
2118
+ }
2119
+ } else {
2120
+ for (var i = 0; i < this.children.length; i++) {
2121
+ var child = this.children[i];
2122
+ try {
2123
+ child.addExpectationResult.apply(child, arguments);
2124
+ } catch(e) {
2125
+ // keep going
2126
+ }
2127
+ }
2128
+ }
2129
+ };
2130
+
2131
+ function isAfterAll(children) {
2132
+ return children && children[0].result.status;
2133
+ }
2134
+
2135
+ function isFailure(args) {
2136
+ return !args[0];
2137
+ }
2138
+
2139
+ function clone(obj) {
2140
+ var clonedObj = {};
2141
+ for (var prop in obj) {
2142
+ if (obj.hasOwnProperty(prop)) {
2143
+ clonedObj[prop] = obj[prop];
2144
+ }
2145
+ }
2146
+
2147
+ return clonedObj;
2148
+ }
2149
+
2150
+ return Suite;
2151
+ };
2152
+
2153
+ if (typeof window == void 0 && typeof exports == 'object') {
2154
+ exports.Suite = jasmineRequire.Suite;
2155
+ }
2156
+
2157
+ getJasmineRequireObj().Timer = function() {
2158
+ var defaultNow = (function(Date) {
2159
+ return function() { return new Date().getTime(); };
2160
+ })(Date);
2161
+
2162
+ function Timer(options) {
2163
+ options = options || {};
2164
+
2165
+ var now = options.now || defaultNow,
2166
+ startTime;
2167
+
2168
+ this.start = function() {
2169
+ startTime = now();
2170
+ };
2171
+
2172
+ this.elapsed = function() {
2173
+ return now() - startTime;
2174
+ };
2175
+ }
2176
+
2177
+ return Timer;
2178
+ };
2179
+
2180
+ getJasmineRequireObj().TreeProcessor = function() {
2181
+ function TreeProcessor(attrs) {
2182
+ var tree = attrs.tree,
2183
+ runnableIds = attrs.runnableIds,
2184
+ queueRunnerFactory = attrs.queueRunnerFactory,
2185
+ nodeStart = attrs.nodeStart || function() {},
2186
+ nodeComplete = attrs.nodeComplete || function() {},
2187
+ stats = { valid: true },
2188
+ processed = false,
2189
+ defaultMin = Infinity,
2190
+ defaultMax = 1 - Infinity;
2191
+
2192
+ this.processTree = function() {
2193
+ processNode(tree, false);
2194
+ processed = true;
2195
+ return stats;
2196
+ };
2197
+
2198
+ this.execute = function(done) {
2199
+ if (!processed) {
2200
+ this.processTree();
2201
+ }
2202
+
2203
+ if (!stats.valid) {
2204
+ throw 'invalid order';
2205
+ }
2206
+
2207
+ var childFns = wrapChildren(tree, 0);
2208
+
2209
+ queueRunnerFactory({
2210
+ queueableFns: childFns,
2211
+ userContext: tree.sharedUserContext(),
2212
+ onException: function() {
2213
+ tree.onException.apply(tree, arguments);
2214
+ },
2215
+ onComplete: done
2216
+ });
2217
+ };
2218
+
2219
+ function runnableIndex(id) {
2220
+ for (var i = 0; i < runnableIds.length; i++) {
2221
+ if (runnableIds[i] === id) {
2222
+ return i;
2223
+ }
2224
+ }
2225
+ }
2226
+
2227
+ function processNode(node, parentEnabled) {
2228
+ var executableIndex = runnableIndex(node.id);
2229
+
2230
+ if (executableIndex !== undefined) {
2231
+ parentEnabled = true;
2232
+ }
2233
+
2234
+ parentEnabled = parentEnabled && node.isExecutable();
2235
+
2236
+ if (!node.children) {
2237
+ stats[node.id] = {
2238
+ executable: parentEnabled && node.isExecutable(),
2239
+ segments: [{
2240
+ index: 0,
2241
+ owner: node,
2242
+ nodes: [node],
2243
+ min: startingMin(executableIndex),
2244
+ max: startingMax(executableIndex)
2245
+ }]
2246
+ };
2247
+ } else {
2248
+ var hasExecutableChild = false;
2249
+
2250
+ for (var i = 0; i < node.children.length; i++) {
2251
+ var child = node.children[i];
2252
+
2253
+ processNode(child, parentEnabled);
2254
+
2255
+ if (!stats.valid) {
2256
+ return;
2257
+ }
2258
+
2259
+ var childStats = stats[child.id];
2260
+
2261
+ hasExecutableChild = hasExecutableChild || childStats.executable;
2262
+ }
2263
+
2264
+ stats[node.id] = {
2265
+ executable: hasExecutableChild
2266
+ };
2267
+
2268
+ segmentChildren(node, stats[node.id], executableIndex);
2269
+
2270
+ if (!node.canBeReentered() && stats[node.id].segments.length > 1) {
2271
+ stats = { valid: false };
2272
+ }
2273
+ }
2274
+ }
2275
+
2276
+ function startingMin(executableIndex) {
2277
+ return executableIndex === undefined ? defaultMin : executableIndex;
2278
+ }
2279
+
2280
+ function startingMax(executableIndex) {
2281
+ return executableIndex === undefined ? defaultMax : executableIndex;
2282
+ }
2283
+
2284
+ function segmentChildren(node, nodeStats, executableIndex) {
2285
+ var currentSegment = { index: 0, owner: node, nodes: [], min: startingMin(executableIndex), max: startingMax(executableIndex) },
2286
+ result = [currentSegment],
2287
+ lastMax = defaultMax,
2288
+ orderedChildSegments = orderChildSegments(node.children);
2289
+
2290
+ function isSegmentBoundary(minIndex) {
2291
+ return lastMax !== defaultMax && minIndex !== defaultMin && lastMax < minIndex - 1;
2292
+ }
2293
+
2294
+ for (var i = 0; i < orderedChildSegments.length; i++) {
2295
+ var childSegment = orderedChildSegments[i],
2296
+ maxIndex = childSegment.max,
2297
+ minIndex = childSegment.min;
2298
+
2299
+ if (isSegmentBoundary(minIndex)) {
2300
+ currentSegment = {index: result.length, owner: node, nodes: [], min: defaultMin, max: defaultMax};
2301
+ result.push(currentSegment);
2302
+ }
2303
+
2304
+ currentSegment.nodes.push(childSegment);
2305
+ currentSegment.min = Math.min(currentSegment.min, minIndex);
2306
+ currentSegment.max = Math.max(currentSegment.max, maxIndex);
2307
+ lastMax = maxIndex;
2308
+ }
2309
+
2310
+ nodeStats.segments = result;
2311
+ }
2312
+
2313
+ function orderChildSegments(children) {
2314
+ var specifiedOrder = [],
2315
+ unspecifiedOrder = [];
2316
+
2317
+ for (var i = 0; i < children.length; i++) {
2318
+ var child = children[i],
2319
+ segments = stats[child.id].segments;
2320
+
2321
+ for (var j = 0; j < segments.length; j++) {
2322
+ var seg = segments[j];
2323
+
2324
+ if (seg.min === defaultMin) {
2325
+ unspecifiedOrder.push(seg);
2326
+ } else {
2327
+ specifiedOrder.push(seg);
2328
+ }
2329
+ }
2330
+ }
2331
+
2332
+ specifiedOrder.sort(function(a, b) {
2333
+ return a.min - b.min;
2334
+ });
2335
+
2336
+ return specifiedOrder.concat(unspecifiedOrder);
2337
+ }
2338
+
2339
+ function executeNode(node, segmentNumber) {
2340
+ if (node.children) {
2341
+ return {
2342
+ fn: function(done) {
2343
+ nodeStart(node);
2344
+
2345
+ queueRunnerFactory({
2346
+ onComplete: function() {
2347
+ nodeComplete(node, node.getResult());
2348
+ done();
2349
+ },
2350
+ queueableFns: wrapChildren(node, segmentNumber),
2351
+ userContext: node.sharedUserContext(),
2352
+ onException: function() {
2353
+ node.onException.apply(node, arguments);
2354
+ }
2355
+ });
2356
+ }
2357
+ };
2358
+ } else {
2359
+ return {
2360
+ fn: function(done) { node.execute(done, stats[node.id].executable); }
2361
+ };
2362
+ }
2363
+ }
2364
+
2365
+ function wrapChildren(node, segmentNumber) {
2366
+ var result = [],
2367
+ segmentChildren = stats[node.id].segments[segmentNumber].nodes;
2368
+
2369
+ for (var i = 0; i < segmentChildren.length; i++) {
2370
+ result.push(executeNode(segmentChildren[i].owner, segmentChildren[i].index));
2371
+ }
2372
+
2373
+ if (!stats[node.id].executable) {
2374
+ return result;
2375
+ }
2376
+
2377
+ return node.beforeAllFns.concat(result).concat(node.afterAllFns);
2378
+ }
2379
+ }
2380
+
2381
+ return TreeProcessor;
2382
+ };
2383
+
2384
+ getJasmineRequireObj().Any = function(j$) {
2385
+
2386
+ function Any(expectedObject) {
2387
+ this.expectedObject = expectedObject;
2388
+ }
2389
+
2390
+ Any.prototype.asymmetricMatch = function(other) {
2391
+ if (this.expectedObject == String) {
2392
+ return typeof other == 'string' || other instanceof String;
2393
+ }
2394
+
2395
+ if (this.expectedObject == Number) {
2396
+ return typeof other == 'number' || other instanceof Number;
2397
+ }
2398
+
2399
+ if (this.expectedObject == Function) {
2400
+ return typeof other == 'function' || other instanceof Function;
2401
+ }
1701
2402
 
1702
- function SpyStrategy(options) {
1703
- options = options || {};
2403
+ if (this.expectedObject == Object) {
2404
+ return typeof other == 'object';
2405
+ }
1704
2406
 
1705
- var identity = options.name || 'unknown',
1706
- originalFn = options.fn || function() {},
1707
- getSpy = options.getSpy || function() {},
1708
- plan = function() {};
2407
+ if (this.expectedObject == Boolean) {
2408
+ return typeof other == 'boolean';
2409
+ }
1709
2410
 
1710
- this.identity = function() {
1711
- return identity;
1712
- };
2411
+ return other instanceof this.expectedObject;
2412
+ };
1713
2413
 
1714
- this.exec = function() {
1715
- return plan.apply(this, arguments);
1716
- };
2414
+ Any.prototype.jasmineToString = function() {
2415
+ return '<jasmine.any(' + j$.fnNameFor(this.expectedObject) + ')>';
2416
+ };
1717
2417
 
1718
- this.callThrough = function() {
1719
- plan = originalFn;
1720
- return getSpy();
1721
- };
2418
+ return Any;
2419
+ };
1722
2420
 
1723
- this.returnValue = function(value) {
1724
- plan = function() {
1725
- return value;
1726
- };
1727
- return getSpy();
1728
- };
2421
+ getJasmineRequireObj().Anything = function(j$) {
1729
2422
 
1730
- this.throwError = function(something) {
1731
- var error = (something instanceof Error) ? something : new Error(something);
1732
- plan = function() {
1733
- throw error;
1734
- };
1735
- return getSpy();
1736
- };
2423
+ function Anything() {}
1737
2424
 
1738
- this.callFake = function(fn) {
1739
- plan = fn;
1740
- return getSpy();
1741
- };
2425
+ Anything.prototype.asymmetricMatch = function(other) {
2426
+ return !j$.util.isUndefined(other) && other !== null;
2427
+ };
1742
2428
 
1743
- this.stub = function(fn) {
1744
- plan = function() {};
1745
- return getSpy();
1746
- };
1747
- }
2429
+ Anything.prototype.jasmineToString = function() {
2430
+ return '<jasmine.anything>';
2431
+ };
1748
2432
 
1749
- return SpyStrategy;
2433
+ return Anything;
1750
2434
  };
1751
2435
 
1752
- getJasmineRequireObj().Suite = function() {
1753
- function Suite(attrs) {
1754
- this.env = attrs.env;
1755
- this.id = attrs.id;
1756
- this.parentSuite = attrs.parentSuite;
1757
- this.description = attrs.description;
1758
- this.onStart = attrs.onStart || function() {};
1759
- this.resultCallback = attrs.resultCallback || function() {};
1760
- this.clearStack = attrs.clearStack || function(fn) {fn();};
1761
-
1762
- this.beforeFns = [];
1763
- this.afterFns = [];
1764
- this.queueRunner = attrs.queueRunner || function() {};
1765
- this.disabled = false;
1766
-
1767
- this.children = [];
1768
-
1769
- this.result = {
1770
- id: this.id,
1771
- status: this.disabled ? 'disabled' : '',
1772
- description: this.description,
1773
- fullName: this.getFullName()
1774
- };
2436
+ getJasmineRequireObj().ArrayContaining = function(j$) {
2437
+ function ArrayContaining(sample) {
2438
+ this.sample = sample;
1775
2439
  }
1776
2440
 
1777
- Suite.prototype.getFullName = function() {
1778
- var fullName = this.description;
1779
- for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
1780
- if (parentSuite.parentSuite) {
1781
- fullName = parentSuite.description + ' ' + fullName;
2441
+ ArrayContaining.prototype.asymmetricMatch = function(other) {
2442
+ var className = Object.prototype.toString.call(this.sample);
2443
+ if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
2444
+
2445
+ for (var i = 0; i < this.sample.length; i++) {
2446
+ var item = this.sample[i];
2447
+ if (!j$.matchersUtil.contains(other, item)) {
2448
+ return false;
1782
2449
  }
1783
2450
  }
1784
- return fullName;
1785
- };
1786
2451
 
1787
- Suite.prototype.disable = function() {
1788
- this.disabled = true;
1789
- this.result.status = 'disabled';
2452
+ return true;
1790
2453
  };
1791
2454
 
1792
- Suite.prototype.beforeEach = function(fn) {
1793
- this.beforeFns.unshift(fn);
2455
+ ArrayContaining.prototype.jasmineToString = function () {
2456
+ return '<jasmine.arrayContaining(' + jasmine.pp(this.sample) +')>';
1794
2457
  };
1795
2458
 
1796
- Suite.prototype.afterEach = function(fn) {
1797
- this.afterFns.unshift(fn);
1798
- };
2459
+ return ArrayContaining;
2460
+ };
1799
2461
 
1800
- Suite.prototype.addChild = function(child) {
1801
- this.children.push(child);
1802
- };
2462
+ getJasmineRequireObj().ObjectContaining = function(j$) {
1803
2463
 
1804
- Suite.prototype.execute = function(onComplete) {
1805
- var self = this;
2464
+ function ObjectContaining(sample) {
2465
+ this.sample = sample;
2466
+ }
1806
2467
 
1807
- this.onStart(this);
2468
+ function getPrototype(obj) {
2469
+ if (Object.getPrototypeOf) {
2470
+ return Object.getPrototypeOf(obj);
2471
+ }
1808
2472
 
1809
- if (this.disabled) {
1810
- complete();
1811
- return;
2473
+ if (obj.constructor.prototype == obj) {
2474
+ return null;
1812
2475
  }
1813
2476
 
1814
- var allFns = [];
2477
+ return obj.constructor.prototype;
2478
+ }
1815
2479
 
1816
- for (var i = 0; i < this.children.length; i++) {
1817
- allFns.push(wrapChildAsAsync(this.children[i]));
2480
+ function hasProperty(obj, property) {
2481
+ if (!obj) {
2482
+ return false;
1818
2483
  }
1819
2484
 
1820
- this.queueRunner({
1821
- fns: allFns,
1822
- onComplete: complete
1823
- });
2485
+ if (Object.prototype.hasOwnProperty.call(obj, property)) {
2486
+ return true;
2487
+ }
1824
2488
 
1825
- function complete() {
1826
- self.resultCallback(self.result);
2489
+ return hasProperty(getPrototype(obj), property);
2490
+ }
1827
2491
 
1828
- if (onComplete) {
1829
- onComplete();
2492
+ ObjectContaining.prototype.asymmetricMatch = function(other) {
2493
+ if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
2494
+
2495
+ for (var property in this.sample) {
2496
+ if (!hasProperty(other, property) ||
2497
+ !j$.matchersUtil.equals(this.sample[property], other[property])) {
2498
+ return false;
1830
2499
  }
1831
2500
  }
1832
2501
 
1833
- function wrapChildAsAsync(child) {
1834
- return function(done) { child.execute(done); };
1835
- }
2502
+ return true;
1836
2503
  };
1837
2504
 
1838
- return Suite;
1839
- };
2505
+ ObjectContaining.prototype.jasmineToString = function() {
2506
+ return '<jasmine.objectContaining(' + j$.pp(this.sample) + ')>';
2507
+ };
1840
2508
 
1841
- if (typeof window == void 0 && typeof exports == 'object') {
1842
- exports.Suite = jasmineRequire.Suite;
1843
- }
2509
+ return ObjectContaining;
2510
+ };
1844
2511
 
1845
- getJasmineRequireObj().Timer = function() {
1846
- var defaultNow = (function(Date) {
1847
- return function() { return new Date().getTime(); };
1848
- })(Date);
2512
+ getJasmineRequireObj().StringMatching = function(j$) {
1849
2513
 
1850
- function Timer(options) {
1851
- options = options || {};
2514
+ function StringMatching(expected) {
2515
+ if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
2516
+ throw new Error('Expected is not a String or a RegExp');
2517
+ }
1852
2518
 
1853
- var now = options.now || defaultNow,
1854
- startTime;
2519
+ this.regexp = new RegExp(expected);
2520
+ }
1855
2521
 
1856
- this.start = function() {
1857
- startTime = now();
1858
- };
2522
+ StringMatching.prototype.asymmetricMatch = function(other) {
2523
+ return this.regexp.test(other);
2524
+ };
1859
2525
 
1860
- this.elapsed = function() {
1861
- return now() - startTime;
1862
- };
1863
- }
2526
+ StringMatching.prototype.jasmineToString = function() {
2527
+ return '<jasmine.stringMatching(' + this.regexp + ')>';
2528
+ };
1864
2529
 
1865
- return Timer;
2530
+ return StringMatching;
1866
2531
  };
1867
2532
 
2533
+ getJasmineRequireObj().errors = function() {
2534
+ function ExpectationFailed() {}
2535
+
2536
+ ExpectationFailed.prototype = new Error();
2537
+ ExpectationFailed.prototype.constructor = ExpectationFailed;
2538
+
2539
+ return {
2540
+ ExpectationFailed: ExpectationFailed
2541
+ };
2542
+ };
1868
2543
  getJasmineRequireObj().matchersUtil = function(j$) {
1869
2544
  // TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
1870
2545
 
@@ -1878,7 +2553,9 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1878
2553
  contains: function(haystack, needle, customTesters) {
1879
2554
  customTesters = customTesters || [];
1880
2555
 
1881
- if (Object.prototype.toString.apply(haystack) === '[object Array]') {
2556
+ if ((Object.prototype.toString.apply(haystack) === '[object Array]') ||
2557
+ (!!haystack && !haystack.indexOf))
2558
+ {
1882
2559
  for (var i = 0; i < haystack.length; i++) {
1883
2560
  if (eq(haystack[i], needle, [], [], customTesters)) {
1884
2561
  return true;
@@ -1886,6 +2563,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1886
2563
  }
1887
2564
  return false;
1888
2565
  }
2566
+
1889
2567
  return !!haystack && haystack.indexOf(needle) >= 0;
1890
2568
  },
1891
2569
 
@@ -1915,11 +2593,37 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1915
2593
  }
1916
2594
  };
1917
2595
 
2596
+ function isAsymmetric(obj) {
2597
+ return obj && j$.isA_('Function', obj.asymmetricMatch);
2598
+ }
2599
+
2600
+ function asymmetricMatch(a, b) {
2601
+ var asymmetricA = isAsymmetric(a),
2602
+ asymmetricB = isAsymmetric(b);
2603
+
2604
+ if (asymmetricA && asymmetricB) {
2605
+ return undefined;
2606
+ }
2607
+
2608
+ if (asymmetricA) {
2609
+ return a.asymmetricMatch(b);
2610
+ }
2611
+
2612
+ if (asymmetricB) {
2613
+ return b.asymmetricMatch(a);
2614
+ }
2615
+ }
2616
+
1918
2617
  // Equality function lovingly adapted from isEqual in
1919
2618
  // [Underscore](http://underscorejs.org)
1920
2619
  function eq(a, b, aStack, bStack, customTesters) {
1921
2620
  var result = true;
1922
2621
 
2622
+ var asymmetricResult = asymmetricMatch(a, b);
2623
+ if (!j$.util.isUndefined(asymmetricResult)) {
2624
+ return asymmetricResult;
2625
+ }
2626
+
1923
2627
  for (var i = 0; i < customTesters.length; i++) {
1924
2628
  var customTesterResult = customTesters[i](a, b);
1925
2629
  if (!j$.util.isUndefined(customTesterResult)) {
@@ -1927,27 +2631,6 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1927
2631
  }
1928
2632
  }
1929
2633
 
1930
- if (a instanceof j$.Any) {
1931
- result = a.jasmineMatches(b);
1932
- if (result) {
1933
- return true;
1934
- }
1935
- }
1936
-
1937
- if (b instanceof j$.Any) {
1938
- result = b.jasmineMatches(a);
1939
- if (result) {
1940
- return true;
1941
- }
1942
- }
1943
-
1944
- if (b instanceof j$.ObjectContaining) {
1945
- result = b.jasmineMatches(a);
1946
- if (result) {
1947
- return true;
1948
- }
1949
- }
1950
-
1951
2634
  if (a instanceof Error && b instanceof Error) {
1952
2635
  return a.message == b.message;
1953
2636
  }
@@ -1983,6 +2666,29 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1983
2666
  a.ignoreCase == b.ignoreCase;
1984
2667
  }
1985
2668
  if (typeof a != 'object' || typeof b != 'object') { return false; }
2669
+
2670
+ var aIsDomNode = j$.isDomNode(a);
2671
+ var bIsDomNode = j$.isDomNode(b);
2672
+ if (aIsDomNode && bIsDomNode) {
2673
+ // At first try to use DOM3 method isEqualNode
2674
+ if (a.isEqualNode) {
2675
+ return a.isEqualNode(b);
2676
+ }
2677
+ // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
2678
+ var aIsElement = a instanceof Element;
2679
+ var bIsElement = b instanceof Element;
2680
+ if (aIsElement && bIsElement) {
2681
+ return a.outerHTML == b.outerHTML;
2682
+ }
2683
+ if (aIsElement || bIsElement) {
2684
+ return false;
2685
+ }
2686
+ return a.innerText == b.innerText && a.textContent == b.textContent;
2687
+ }
2688
+ if (aIsDomNode || bIsDomNode) {
2689
+ return false;
2690
+ }
2691
+
1986
2692
  // Assume equality for cyclic structures. The algorithm for detecting cyclic
1987
2693
  // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
1988
2694
  var length = aStack.length;
@@ -1996,23 +2702,20 @@ getJasmineRequireObj().matchersUtil = function(j$) {
1996
2702
  bStack.push(b);
1997
2703
  var size = 0;
1998
2704
  // Recursively compare objects and arrays.
1999
- if (className == '[object Array]') {
2000
- // Compare array lengths to determine if a deep comparison is necessary.
2001
- size = a.length;
2002
- result = size == b.length;
2003
- if (result) {
2004
- // Deep compare the contents, ignoring non-numeric properties.
2005
- while (size--) {
2006
- if (!(result = eq(a[size], b[size], aStack, bStack, customTesters))) { break; }
2007
- }
2008
- }
2009
- } else {
2705
+ // Compare array lengths to determine if a deep comparison is necessary.
2706
+ if (className == '[object Array]' && a.length !== b.length) {
2707
+ result = false;
2708
+ }
2709
+
2710
+ if (result) {
2010
2711
  // Objects with different constructors are not equivalent, but `Object`s
2011
- // from different frames are.
2012
- var aCtor = a.constructor, bCtor = b.constructor;
2013
- if (aCtor !== bCtor && !(isFunction(aCtor) && (aCtor instanceof aCtor) &&
2014
- isFunction(bCtor) && (bCtor instanceof bCtor))) {
2015
- return false;
2712
+ // or `Array`s from different frames are.
2713
+ if (className !== '[object Array]') {
2714
+ var aCtor = a.constructor, bCtor = b.constructor;
2715
+ if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor &&
2716
+ isFunction(bCtor) && bCtor instanceof bCtor)) {
2717
+ return false;
2718
+ }
2016
2719
  }
2017
2720
  // Deep compare objects.
2018
2721
  for (var key in a) {
@@ -2038,7 +2741,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
2038
2741
  return result;
2039
2742
 
2040
2743
  function has(obj, key) {
2041
- return obj.hasOwnProperty(key);
2744
+ return Object.prototype.hasOwnProperty.call(obj, key);
2042
2745
  }
2043
2746
 
2044
2747
  function isFunction(obj) {
@@ -2307,11 +3010,15 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
2307
3010
  return toHaveBeenCalledWith;
2308
3011
  };
2309
3012
 
2310
- getJasmineRequireObj().toMatch = function() {
3013
+ getJasmineRequireObj().toMatch = function(j$) {
2311
3014
 
2312
3015
  function toMatch() {
2313
3016
  return {
2314
3017
  compare: function(actual, expected) {
3018
+ if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
3019
+ throw new Error('Expected is not a String or a RegExp');
3020
+ }
3021
+
2315
3022
  var regexp = new RegExp(expected);
2316
3023
 
2317
3024
  return {
@@ -2378,18 +3085,13 @@ getJasmineRequireObj().toThrowError = function(j$) {
2378
3085
  var threw = false,
2379
3086
  pass = {pass: true},
2380
3087
  fail = {pass: false},
2381
- thrown,
2382
- errorType,
2383
- message,
2384
- regexp,
2385
- name,
2386
- constructorName;
3088
+ thrown;
2387
3089
 
2388
3090
  if (typeof actual != 'function') {
2389
3091
  throw new Error('Actual is not a Function');
2390
3092
  }
2391
3093
 
2392
- extractExpectedParams.apply(null, arguments);
3094
+ var errorMatcher = getMatcher.apply(null, arguments);
2393
3095
 
2394
3096
  try {
2395
3097
  actual();
@@ -2408,121 +3110,104 @@ getJasmineRequireObj().toThrowError = function(j$) {
2408
3110
  return fail;
2409
3111
  }
2410
3112
 
2411
- if (arguments.length == 1) {
2412
- pass.message = 'Expected function not to throw an Error, but it threw ' + fnNameFor(thrown) + '.';
3113
+ if (errorMatcher.hasNoSpecifics()) {
3114
+ pass.message = 'Expected function not to throw an Error, but it threw ' + j$.fnNameFor(thrown) + '.';
2413
3115
  return pass;
2414
3116
  }
2415
3117
 
2416
- if (errorType) {
2417
- name = fnNameFor(errorType);
2418
- constructorName = fnNameFor(thrown.constructor);
3118
+ if (errorMatcher.matches(thrown)) {
3119
+ pass.message = function() {
3120
+ return 'Expected function not to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + '.';
3121
+ };
3122
+ return pass;
3123
+ } else {
3124
+ fail.message = function() {
3125
+ return 'Expected function to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() +
3126
+ ', but it threw ' + errorMatcher.thrownDescription(thrown) + '.';
3127
+ };
3128
+ return fail;
2419
3129
  }
3130
+ }
3131
+ };
2420
3132
 
2421
- if (errorType && message) {
2422
- if (thrown.constructor == errorType && util.equals(thrown.message, message)) {
2423
- pass.message = function() { return 'Expected function not to throw ' + name + ' with message ' + j$.pp(message) + '.'; };
2424
- return pass;
2425
- } else {
2426
- fail.message = function() { return 'Expected function to throw ' + name + ' with message ' + j$.pp(message) +
2427
- ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
2428
- return fail;
2429
- }
2430
- }
3133
+ function getMatcher() {
3134
+ var expected = null,
3135
+ errorType = null;
2431
3136
 
2432
- if (errorType && regexp) {
2433
- if (thrown.constructor == errorType && regexp.test(thrown.message)) {
2434
- pass.message = function() { return 'Expected function not to throw ' + name + ' with message matching ' + j$.pp(regexp) + '.'; };
2435
- return pass;
2436
- } else {
2437
- fail.message = function() { return 'Expected function to throw ' + name + ' with message matching ' + j$.pp(regexp) +
2438
- ', but it threw ' + constructorName + ' with message ' + j$.pp(thrown.message) + '.'; };
2439
- return fail;
2440
- }
3137
+ if (arguments.length == 2) {
3138
+ expected = arguments[1];
3139
+ if (isAnErrorType(expected)) {
3140
+ errorType = expected;
3141
+ expected = null;
2441
3142
  }
2442
-
2443
- if (errorType) {
2444
- if (thrown.constructor == errorType) {
2445
- pass.message = 'Expected function not to throw ' + name + '.';
2446
- return pass;
2447
- } else {
2448
- fail.message = 'Expected function to throw ' + name + ', but it threw ' + constructorName + '.';
2449
- return fail;
2450
- }
3143
+ } else if (arguments.length > 2) {
3144
+ errorType = arguments[1];
3145
+ expected = arguments[2];
3146
+ if (!isAnErrorType(errorType)) {
3147
+ throw new Error('Expected error type is not an Error.');
2451
3148
  }
3149
+ }
2452
3150
 
2453
- if (message) {
2454
- if (thrown.message == message) {
2455
- pass.message = function() { return 'Expected function not to throw an exception with message ' + j$.pp(message) + '.'; };
2456
- return pass;
2457
- } else {
2458
- fail.message = function() { return 'Expected function to throw an exception with message ' + j$.pp(message) +
2459
- ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
2460
- return fail;
2461
- }
3151
+ if (expected && !isStringOrRegExp(expected)) {
3152
+ if (errorType) {
3153
+ throw new Error('Expected error message is not a string or RegExp.');
3154
+ } else {
3155
+ throw new Error('Expected is not an Error, string, or RegExp.');
2462
3156
  }
3157
+ }
2463
3158
 
2464
- if (regexp) {
2465
- if (regexp.test(thrown.message)) {
2466
- pass.message = function() { return 'Expected function not to throw an exception with a message matching ' + j$.pp(regexp) + '.'; };
2467
- return pass;
2468
- } else {
2469
- fail.message = function() { return 'Expected function to throw an exception with a message matching ' + j$.pp(regexp) +
2470
- ', but it threw an exception with message ' + j$.pp(thrown.message) + '.'; };
2471
- return fail;
2472
- }
3159
+ function messageMatch(message) {
3160
+ if (typeof expected == 'string') {
3161
+ return expected == message;
3162
+ } else {
3163
+ return expected.test(message);
2473
3164
  }
3165
+ }
2474
3166
 
2475
- function fnNameFor(func) {
2476
- return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
2477
- }
3167
+ return {
3168
+ errorTypeDescription: errorType ? j$.fnNameFor(errorType) : 'an exception',
3169
+ thrownDescription: function(thrown) {
3170
+ var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception',
3171
+ thrownMessage = '';
2478
3172
 
2479
- function extractExpectedParams() {
2480
- if (arguments.length == 1) {
2481
- return;
3173
+ if (expected) {
3174
+ thrownMessage = ' with message ' + j$.pp(thrown.message);
2482
3175
  }
2483
3176
 
2484
- if (arguments.length == 2) {
2485
- var expected = arguments[1];
2486
-
2487
- if (expected instanceof RegExp) {
2488
- regexp = expected;
2489
- } else if (typeof expected == 'string') {
2490
- message = expected;
2491
- } else if (checkForAnErrorType(expected)) {
2492
- errorType = expected;
2493
- }
2494
-
2495
- if (!(errorType || message || regexp)) {
2496
- throw new Error('Expected is not an Error, string, or RegExp.');
2497
- }
3177
+ return thrownName + thrownMessage;
3178
+ },
3179
+ messageDescription: function() {
3180
+ if (expected === null) {
3181
+ return '';
3182
+ } else if (expected instanceof RegExp) {
3183
+ return ' with a message matching ' + j$.pp(expected);
2498
3184
  } else {
2499
- if (checkForAnErrorType(arguments[1])) {
2500
- errorType = arguments[1];
2501
- } else {
2502
- throw new Error('Expected error type is not an Error.');
2503
- }
2504
-
2505
- if (arguments[2] instanceof RegExp) {
2506
- regexp = arguments[2];
2507
- } else if (typeof arguments[2] == 'string') {
2508
- message = arguments[2];
2509
- } else {
2510
- throw new Error('Expected error message is not a string or RegExp.');
2511
- }
3185
+ return ' with message ' + j$.pp(expected);
2512
3186
  }
3187
+ },
3188
+ hasNoSpecifics: function() {
3189
+ return expected === null && errorType === null;
3190
+ },
3191
+ matches: function(error) {
3192
+ return (errorType === null || error instanceof errorType) &&
3193
+ (expected === null || messageMatch(error.message));
2513
3194
  }
3195
+ };
3196
+ }
2514
3197
 
2515
- function checkForAnErrorType(type) {
2516
- if (typeof type !== 'function') {
2517
- return false;
2518
- }
3198
+ function isStringOrRegExp(potential) {
3199
+ return potential instanceof RegExp || (typeof potential == 'string');
3200
+ }
2519
3201
 
2520
- var Surrogate = function() {};
2521
- Surrogate.prototype = type.prototype;
2522
- return (new Surrogate()) instanceof Error;
2523
- }
3202
+ function isAnErrorType(type) {
3203
+ if (typeof type !== 'function') {
3204
+ return false;
2524
3205
  }
2525
- };
3206
+
3207
+ var Surrogate = function() {};
3208
+ Surrogate.prototype = type.prototype;
3209
+ return (new Surrogate()) instanceof Error;
3210
+ }
2526
3211
  }
2527
3212
 
2528
3213
  return toThrowError;
@@ -2538,20 +3223,36 @@ getJasmineRequireObj().interface = function(jasmine, env) {
2538
3223
  return env.xdescribe(description, specDefinitions);
2539
3224
  },
2540
3225
 
2541
- it: function(desc, func) {
2542
- return env.it(desc, func);
3226
+ fdescribe: function(description, specDefinitions) {
3227
+ return env.fdescribe(description, specDefinitions);
3228
+ },
3229
+
3230
+ it: function() {
3231
+ return env.it.apply(env, arguments);
2543
3232
  },
2544
3233
 
2545
- xit: function(desc, func) {
2546
- return env.xit(desc, func);
3234
+ xit: function() {
3235
+ return env.xit.apply(env, arguments);
2547
3236
  },
2548
3237
 
2549
- beforeEach: function(beforeEachFunction) {
2550
- return env.beforeEach(beforeEachFunction);
3238
+ fit: function() {
3239
+ return env.fit.apply(env, arguments);
2551
3240
  },
2552
3241
 
2553
- afterEach: function(afterEachFunction) {
2554
- return env.afterEach(afterEachFunction);
3242
+ beforeEach: function() {
3243
+ return env.beforeEach.apply(env, arguments);
3244
+ },
3245
+
3246
+ afterEach: function() {
3247
+ return env.afterEach.apply(env, arguments);
3248
+ },
3249
+
3250
+ beforeAll: function() {
3251
+ return env.beforeAll.apply(env, arguments);
3252
+ },
3253
+
3254
+ afterAll: function() {
3255
+ return env.afterAll.apply(env, arguments);
2555
3256
  },
2556
3257
 
2557
3258
  expect: function(actual) {
@@ -2559,7 +3260,11 @@ getJasmineRequireObj().interface = function(jasmine, env) {
2559
3260
  },
2560
3261
 
2561
3262
  pending: function() {
2562
- return env.pending();
3263
+ return env.pending.apply(env, arguments);
3264
+ },
3265
+
3266
+ fail: function() {
3267
+ return env.fail.apply(env, arguments);
2563
3268
  },
2564
3269
 
2565
3270
  spyOn: function(obj, methodName) {
@@ -2589,5 +3294,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
2589
3294
  };
2590
3295
 
2591
3296
  getJasmineRequireObj().version = function() {
2592
- return '2.0.4';
3297
+ return '2.3.4';
2593
3298
  };