mocha 1.8.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +3 -0
  4. data/.rubocop_todo.yml +7 -30
  5. data/.yardopts +1 -0
  6. data/CONTRIBUTING.md +1 -1
  7. data/README.md +56 -31
  8. data/RELEASE.md +166 -0
  9. data/Rakefile +15 -7
  10. data/init.rb +1 -3
  11. data/lib/mocha/any_instance_method.rb +11 -53
  12. data/lib/mocha/api.rb +119 -56
  13. data/lib/mocha/block_matcher.rb +31 -0
  14. data/lib/mocha/cardinality.rb +52 -34
  15. data/lib/mocha/class_methods.rb +17 -15
  16. data/lib/mocha/configuration.rb +351 -67
  17. data/lib/mocha/deprecation.rb +2 -1
  18. data/lib/mocha/detection/test_unit.rb +1 -3
  19. data/lib/mocha/exception_raiser.rb +2 -1
  20. data/lib/mocha/expectation.rb +120 -81
  21. data/lib/mocha/expectation_error.rb +1 -3
  22. data/lib/mocha/expectation_list.rb +6 -6
  23. data/lib/mocha/inspect.rb +30 -26
  24. data/lib/mocha/instance_method.rb +19 -2
  25. data/lib/mocha/integration/mini_test.rb +7 -0
  26. data/lib/mocha/integration/test_unit.rb +7 -0
  27. data/lib/mocha/integration.rb +1 -3
  28. data/lib/mocha/invocation.rb +77 -0
  29. data/lib/mocha/macos_version.rb +5 -0
  30. data/lib/mocha/minitest.rb +6 -1
  31. data/lib/mocha/mock.rb +80 -39
  32. data/lib/mocha/mockery.rb +34 -80
  33. data/lib/mocha/names.rb +1 -1
  34. data/lib/mocha/object_methods.rb +13 -19
  35. data/lib/mocha/parameter_matchers/all_of.rb +1 -1
  36. data/lib/mocha/parameter_matchers/any_of.rb +1 -1
  37. data/lib/mocha/parameter_matchers/equivalent_uri.rb +0 -9
  38. data/lib/mocha/parameter_matchers/has_entries.rb +2 -3
  39. data/lib/mocha/parameter_matchers/has_entry.rb +24 -16
  40. data/lib/mocha/parameter_matchers/has_key.rb +2 -3
  41. data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
  42. data/lib/mocha/parameter_matchers/has_value.rb +2 -3
  43. data/lib/mocha/parameter_matchers/includes.rb +2 -0
  44. data/lib/mocha/parameter_matchers/instance_methods.rb +18 -0
  45. data/lib/mocha/parameter_matchers/is_a.rb +2 -3
  46. data/lib/mocha/parameter_matchers/not.rb +2 -3
  47. data/lib/mocha/parameter_matchers.rb +2 -1
  48. data/lib/mocha/raised_exception.rb +11 -0
  49. data/lib/mocha/return_values.rb +3 -3
  50. data/lib/mocha/setup.rb +5 -0
  51. data/lib/mocha/single_return_value.rb +2 -1
  52. data/lib/mocha/singleton_class.rb +9 -0
  53. data/lib/mocha/state_machine.rb +31 -40
  54. data/lib/mocha/stubbed_method.rb +125 -0
  55. data/lib/mocha/test_unit.rb +6 -1
  56. data/lib/mocha/thrower.rb +2 -1
  57. data/lib/mocha/thrown_object.rb +12 -0
  58. data/lib/mocha/version.rb +1 -1
  59. data/lib/mocha/yield_parameters.rb +5 -11
  60. data/lib/mocha.rb +8 -0
  61. data/mocha.gemspec +14 -10
  62. metadata +16 -233
  63. data/bin/build-matrix +0 -83
  64. data/docs/CNAME +0 -1
  65. data/docs/Mocha/API.html +0 -1056
  66. data/docs/Mocha/ClassMethods.html +0 -267
  67. data/docs/Mocha/Configuration.html +0 -626
  68. data/docs/Mocha/Expectation.html +0 -2709
  69. data/docs/Mocha/ExpectationError.html +0 -157
  70. data/docs/Mocha/ExpectationErrorFactory.html +0 -269
  71. data/docs/Mocha/Hooks.html +0 -385
  72. data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -165
  73. data/docs/Mocha/Integration/MiniTest.html +0 -123
  74. data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -165
  75. data/docs/Mocha/Integration/TestUnit.html +0 -123
  76. data/docs/Mocha/Integration.html +0 -125
  77. data/docs/Mocha/Mock.html +0 -1197
  78. data/docs/Mocha/ObjectMethods.html +0 -712
  79. data/docs/Mocha/ParameterMatchers/AllOf.html +0 -154
  80. data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -154
  81. data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
  82. data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
  83. data/docs/Mocha/ParameterMatchers/Base.html +0 -448
  84. data/docs/Mocha/ParameterMatchers/Equals.html +0 -154
  85. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
  86. data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -154
  87. data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -154
  88. data/docs/Mocha/ParameterMatchers/HasKey.html +0 -154
  89. data/docs/Mocha/ParameterMatchers/HasValue.html +0 -154
  90. data/docs/Mocha/ParameterMatchers/Includes.html +0 -154
  91. data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -154
  92. data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
  93. data/docs/Mocha/ParameterMatchers/KindOf.html +0 -154
  94. data/docs/Mocha/ParameterMatchers/Not.html +0 -154
  95. data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
  96. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -154
  97. data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -154
  98. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -154
  99. data/docs/Mocha/ParameterMatchers.html +0 -3049
  100. data/docs/Mocha/Sequence.html +0 -149
  101. data/docs/Mocha/StateMachine/State.html +0 -141
  102. data/docs/Mocha/StateMachine/StatePredicate.html +0 -141
  103. data/docs/Mocha/StateMachine.html +0 -539
  104. data/docs/Mocha/StubbingError.html +0 -150
  105. data/docs/Mocha/UnexpectedInvocation.html +0 -140
  106. data/docs/Mocha.html +0 -127
  107. data/docs/_index.html +0 -537
  108. data/docs/class_list.html +0 -51
  109. data/docs/css/common.css +0 -1
  110. data/docs/css/full_list.css +0 -58
  111. data/docs/css/style.css +0 -496
  112. data/docs/file.COPYING.html +0 -81
  113. data/docs/file.MIT-LICENSE.html +0 -85
  114. data/docs/file.README.html +0 -418
  115. data/docs/file.RELEASE.html +0 -875
  116. data/docs/file_list.html +0 -71
  117. data/docs/frames.html +0 -17
  118. data/docs/index.html +0 -418
  119. data/docs/js/app.js +0 -292
  120. data/docs/js/full_list.js +0 -216
  121. data/docs/js/jquery.js +0 -4
  122. data/docs/method_list.html +0 -571
  123. data/docs/top-level-namespace.html +0 -118
  124. data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
  125. data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
  126. data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
  127. data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
  128. data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
  129. data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
  130. data/gemfiles/Gemfile.minitest.2.11.0 +0 -7
  131. data/gemfiles/Gemfile.minitest.2.11.2 +0 -7
  132. data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
  133. data/gemfiles/Gemfile.test-unit.2.0.0 +0 -7
  134. data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
  135. data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
  136. data/lib/mocha/class_method.rb +0 -113
  137. data/lib/mocha/mini_test.rb +0 -5
  138. data/lib/mocha/module_method.rb +0 -6
  139. data/lib/mocha/module_methods.rb +0 -10
  140. data/lib/mocha/multiple_yields.rb +0 -15
  141. data/lib/mocha/no_yields.rb +0 -5
  142. data/lib/mocha/parameter_matchers/object.rb +0 -15
  143. data/lib/mocha/pretty_parameters.rb +0 -24
  144. data/lib/mocha/single_yield.rb +0 -13
  145. data/lib/mocha/standalone.rb +0 -4
  146. data/lib/mocha/unexpected_invocation.rb +0 -24
  147. data/lib/mocha_standalone.rb +0 -4
  148. data/test/acceptance/acceptance_test_helper.rb +0 -35
  149. data/test/acceptance/bug_18914_test.rb +0 -38
  150. data/test/acceptance/bug_21465_test.rb +0 -32
  151. data/test/acceptance/bug_21563_test.rb +0 -23
  152. data/test/acceptance/exception_rescue_test.rb +0 -54
  153. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -56
  154. data/test/acceptance/expected_invocation_count_test.rb +0 -230
  155. data/test/acceptance/failure_messages_test.rb +0 -62
  156. data/test/acceptance/issue_272_test.rb +0 -51
  157. data/test/acceptance/issue_65_test.rb +0 -65
  158. data/test/acceptance/issue_70_test.rb +0 -54
  159. data/test/acceptance/mocha_example_test.rb +0 -97
  160. data/test/acceptance/mocha_test_result_test.rb +0 -84
  161. data/test/acceptance/mock_test.rb +0 -98
  162. data/test/acceptance/mock_with_initializer_block_test.rb +0 -56
  163. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -76
  164. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -67
  165. data/test/acceptance/optional_parameters_test.rb +0 -68
  166. data/test/acceptance/parameter_matcher_test.rb +0 -300
  167. data/test/acceptance/partial_mocks_test.rb +0 -45
  168. data/test/acceptance/prepend_test.rb +0 -87
  169. data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -77
  170. data/test/acceptance/raise_exception_test.rb +0 -37
  171. data/test/acceptance/return_value_test.rb +0 -50
  172. data/test/acceptance/sequence_test.rb +0 -190
  173. data/test/acceptance/states_test.rb +0 -72
  174. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -65
  175. data/test/acceptance/stub_any_instance_method_test.rb +0 -282
  176. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -106
  177. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -79
  178. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -74
  179. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -145
  180. data/test/acceptance/stub_everything_test.rb +0 -54
  181. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -92
  182. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -68
  183. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -68
  184. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -137
  185. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -77
  186. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -76
  187. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -68
  188. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -71
  189. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -39
  190. data/test/acceptance/stub_module_method_test.rb +0 -201
  191. data/test/acceptance/stub_test.rb +0 -50
  192. data/test/acceptance/stubba_example_test.rb +0 -94
  193. data/test/acceptance/stubba_test_result_test.rb +0 -72
  194. data/test/acceptance/stubbing_error_backtrace_test.rb +0 -64
  195. data/test/acceptance/stubbing_frozen_object_test.rb +0 -89
  196. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -53
  197. data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
  198. data/test/acceptance/stubbing_nil_test.rb +0 -60
  199. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -141
  200. data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
  201. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
  202. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
  203. data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
  204. data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
  205. data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
  206. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -34
  207. data/test/acceptance/throw_test.rb +0 -43
  208. data/test/acceptance/unexpected_invocation_test.rb +0 -24
  209. data/test/acceptance/unstubbing_test.rb +0 -195
  210. data/test/assertions.rb +0 -8
  211. data/test/deprecation_disabler.rb +0 -15
  212. data/test/execution_point.rb +0 -36
  213. data/test/integration/mini_test_test.rb +0 -8
  214. data/test/integration/shared_tests.rb +0 -176
  215. data/test/integration/test_unit_test.rb +0 -8
  216. data/test/method_definer.rb +0 -22
  217. data/test/mini_test_result.rb +0 -96
  218. data/test/minitest_result.rb +0 -48
  219. data/test/simple_counter.rb +0 -11
  220. data/test/test_helper.rb +0 -58
  221. data/test/test_runner.rb +0 -56
  222. data/test/test_unit_result.rb +0 -22
  223. data/test/unit/any_instance_method_test.rb +0 -150
  224. data/test/unit/array_inspect_test.rb +0 -14
  225. data/test/unit/backtrace_filter_test.rb +0 -17
  226. data/test/unit/cardinality_test.rb +0 -54
  227. data/test/unit/central_test.rb +0 -99
  228. data/test/unit/change_state_side_effect_test.rb +0 -37
  229. data/test/unit/class_method_test.rb +0 -254
  230. data/test/unit/class_methods_test.rb +0 -69
  231. data/test/unit/configuration_test.rb +0 -37
  232. data/test/unit/date_time_inspect_test.rb +0 -19
  233. data/test/unit/exception_raiser_test.rb +0 -40
  234. data/test/unit/expectation_list_test.rb +0 -80
  235. data/test/unit/expectation_test.rb +0 -492
  236. data/test/unit/hash_inspect_test.rb +0 -14
  237. data/test/unit/hooks_test.rb +0 -35
  238. data/test/unit/in_state_ordering_constraint_test.rb +0 -39
  239. data/test/unit/method_matcher_test.rb +0 -26
  240. data/test/unit/mock_test.rb +0 -363
  241. data/test/unit/mockery_test.rb +0 -174
  242. data/test/unit/module_methods_test.rb +0 -17
  243. data/test/unit/multiple_yields_test.rb +0 -16
  244. data/test/unit/no_yields_test.rb +0 -16
  245. data/test/unit/object_inspect_test.rb +0 -58
  246. data/test/unit/object_methods_test.rb +0 -62
  247. data/test/unit/parameter_matchers/all_of_test.rb +0 -24
  248. data/test/unit/parameter_matchers/any_of_test.rb +0 -24
  249. data/test/unit/parameter_matchers/anything_test.rb +0 -19
  250. data/test/unit/parameter_matchers/equals_test.rb +0 -23
  251. data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -50
  252. data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
  253. data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
  254. data/test/unit/parameter_matchers/has_key_test.rb +0 -54
  255. data/test/unit/parameter_matchers/has_value_test.rb +0 -55
  256. data/test/unit/parameter_matchers/includes_test.rb +0 -106
  257. data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
  258. data/test/unit/parameter_matchers/is_a_test.rb +0 -23
  259. data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
  260. data/test/unit/parameter_matchers/not_test.rb +0 -24
  261. data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
  262. data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
  263. data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
  264. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
  265. data/test/unit/parameters_matcher_test.rb +0 -119
  266. data/test/unit/receivers_test.rb +0 -96
  267. data/test/unit/return_values_test.rb +0 -61
  268. data/test/unit/sequence_test.rb +0 -100
  269. data/test/unit/single_return_value_test.rb +0 -12
  270. data/test/unit/single_yield_test.rb +0 -16
  271. data/test/unit/state_machine_test.rb +0 -96
  272. data/test/unit/string_inspect_test.rb +0 -9
  273. data/test/unit/thrower_test.rb +0 -18
  274. data/test/unit/yield_parameters_test.rb +0 -91
@@ -1,875 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- File: RELEASE
8
-
9
- &mdash; Mocha 1.8.0
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "RELEASE";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="file_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index</a> &raquo;
40
- <span class="title">File: RELEASE</span>
41
-
42
- </div>
43
-
44
- <div id="search">
45
-
46
- <a class="full_list_link" id="class_list_link"
47
- href="class_list.html">
48
-
49
- <svg width="24" height="24">
50
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
- </svg>
54
- </a>
55
-
56
- </div>
57
- <div class="clear"></div>
58
- </div>
59
-
60
- <div id="content"><div id='filecontents'><h1>Release Notes</h1>
61
-
62
- <h2>1.8.0</h2>
63
-
64
- <ul>
65
- <li>Constrain rubocop version to avoid breaking Travis CI builds (05e507f5)</li>
66
- <li>Avoid calling Kernel#format from ObjectMethods#mocha_inspect - thanks to @hoffmanilya (#345)</li>
67
- <li>Fix build matrix script (#346)</li>
68
- <li>Avoid deprecation warning in gemspec (4976e0bc)</li>
69
- <li>Removed link to documentation translation (ef428ea2)</li>
70
- <li>Don&#39;t use the new bundler v2 in builds (683ded9b)</li>
71
- <li>Moved documentation from <a href="https://gofreerange.com/mocha/docs">https://gofreerange.com/mocha/docs</a> to <a href="https://mocha.jamesmead.org/">https://mocha.jamesmead.org/</a> <a href="https://github.com/freerange/mocha/compare/683ded...a17fde">683ded...a17fde</a></li>
72
- </ul>
73
-
74
- <h2>1.7.0</h2>
75
-
76
- <ul>
77
- <li>Update Ruby &amp; JRuby versions in Travis CI config (9bf55631 &amp; 3883af7e)</li>
78
- <li>Simplify gemspec (63744f86)</li>
79
- <li>Add rubocop and fix most cop violations (#341)</li>
80
- <li>Use Kernel#warn for deprecations - thanks to @etiennebarrie (#333, 196970a)</li>
81
- </ul>
82
-
83
- <h2>1.6.0</h2>
84
-
85
- <ul>
86
- <li>Fix subtle bug in setting correct visibility of stubbed module methods on <code>Kernel</code> or <code>Object</code> - thanks to @chrisroos (#295)</li>
87
- <li>Avoid mocks for partial mocking leaking into subsequent tests - thanks to @skliew for reporting (#331)</li>
88
- <li>Remove OpenCollective badge, backers &amp; sponsors (a283a079)</li>
89
- <li>Change gem version badge to SVG format and add SemVer stability badge - thanks to @greysteil (#335)</li>
90
- <li>Improve documentation for Configuration (#236)</li>
91
- </ul>
92
-
93
- <h2>1.5.0</h2>
94
-
95
- <ul>
96
- <li>Prevent use of Mocha outside the context of a test/example - thanks to @andyw8 &amp; @lzap (#327)</li>
97
- </ul>
98
-
99
- <h2>1.4.0</h2>
100
-
101
- <ul>
102
- <li>Fix deprecation warning for <code>assert_nil</code> in <code>ClassMethodTest</code> (#308 &amp; #309)</li>
103
- <li>Display file and line number in deprecation warning - thanks to @chrisarcand (#310, #312 &amp; #313)</li>
104
- <li>Rename <code>mocha/mini_test.rb</code> to <code>mocha/minitest.rb</code> - thanks to @grosser (#320 &amp; #322)</li>
105
- <li>Fix warning when delegating to mock in Ruby 2.4 - thanks to @tjvc (#321 &amp; #323)</li>
106
- <li>Updates to Travis CI configuration (<a href="https://github.com/freerange/mocha/compare/73af600...9732726">73af600..9732726</a> &amp; 0426e5e)</li>
107
- </ul>
108
-
109
- <h2>1.3.0</h2>
110
-
111
- <ul>
112
- <li>Ensure all tests run individually - thanks to @chrisroos (#267)</li>
113
- <li>Update Travis CI build status badge to show master branch status (#264)</li>
114
- <li>Correct RSpec section of the README - thanks to @myronmarston (0cc039c8)</li>
115
- <li>Fix pretty printing of quotes in <code>String#mocha_inspect</code> (#215 &amp; #223)</li>
116
- <li>Add release instructions to README - thanks to @chrisroos (70a5febd &amp; 3c664df7)</li>
117
- <li>Require at least Ruby v1.8.7 in gemspec - thanks to @knappe (3e20be8e)</li>
118
- <li>Remove redundant InstanceMethod#method_exists? - thanks to @chrisroos (8f58eddf)</li>
119
- <li>Reduce risk of hitting bug 12832 in Ruby v2.3 - thanks to @chrisroos (#277 &amp; eca7560c)</li>
120
- <li>Fix JRuby build - thanks to @headius (jruby/jruby#4250) &amp; @chrisroos (#274)</li>
121
- <li>Add latest stable version of JRuby to Travis CI build matrix (#288)</li>
122
- <li>Fix Ruby v1.8.7 builds on Travis CI (928b5a40 &amp; 460dce5b)</li>
123
- <li>Deprecate passing block to mock object constructor (#290)</li>
124
- <li>Add a known issue to README for Ruby bug 12876 (#276)</li>
125
- <li>Add Ruby 2.4 and ruby-head to Travis CI build matrix - thanks to @junaruga (#297)</li>
126
- <li>Fix <code>Mocha::ParameterMatchers#includes</code> for <code>Array</code> values - thanks to @timcraft (#302)</li>
127
- <li>Use faster container-based virtual environments for Travis CI builds (#305)</li>
128
- <li>Rename <code>Mocha::ParameterMatchers::QueryStringMatches</code> to <code>QueryString</code> (#306)</li>
129
- <li>Handle blank parameter value for query string matcher - thanks to @weynsee (#303 &amp; #304)</li>
130
- <li>Rename <code>Mocha::ParameterMatchers::QueryString</code> -&gt; <code>EquivalentUri</code> (#307)</li>
131
- <li>Use <code>do ... end</code> instead of <code>{ ... }</code> in acceptance tests - thanks to @chrisroos (#294)</li>
132
- </ul>
133
-
134
- <h2>1.2.1</h2>
135
-
136
- <ul>
137
- <li>Fixed #272. Workaround Ruby bug 12832 which caused interpreter to hang. See <a href="https://bugs.ruby-lang.org/issues/12832">https://bugs.ruby-lang.org/issues/12832</a>. Thanks to @chrisroos &amp; @petems (6f1c8b9b, #273).</li>
138
- </ul>
139
-
140
- <h2>1.2.0</h2>
141
-
142
- <ul>
143
- <li>Always use prepended module to stub class &amp; instance methods for Ruby v2+ - thanks to @grosser &amp; @chrisroos (43d56671, #244)</li>
144
- <li>Always use prepended module to stub AnyInstance methods in Ruby v2+ - thanks to @chrisroos (#262)</li>
145
- <li>Always set visibility of stub method to match stubbed method on included module - thanks to @grosser &amp; @chrisroos (e87c03b0, #248)</li>
146
- <li>Always set visibility to stub method to match stubbed method on superclass - thanks to @chrisroos (38d902ad)</li>
147
- <li>Allow stubbing of method to which any instance responds (#200)</li>
148
- <li>Allow <code>includes</code> matcher to take matcher arguments - thanks to @lazyatom (#217)</li>
149
- <li>Avoid exception in older version of Rubygems - thanks to @chrisroos (78d930a7)</li>
150
- <li>Add licenses to gemspec as requested by @coreyhaines (#201)</li>
151
- <li>Fix typo in README - thanks to @jaredbeck (6119460d)</li>
152
- <li>Added section about using Mocha with RSpec &amp; Rails to README (#221)</li>
153
- <li>Fix documentation for Mocha::API#stub method - thanks to @raeno (599b1dcd)</li>
154
- <li>Added backers and sponsors from OpenCollective - thanks to @piamancini (#253)</li>
155
- <li>Fix typo in docs for equals - thanks to @alexcoco (#254)</li>
156
- <li>Add known issue for Ruby v1.8 to README - thanks to @chrisroos (2c642096)</li>
157
- </ul>
158
-
159
- <h2>1.1.0</h2>
160
-
161
- <ul>
162
- <li>Set visibility of any instance stub method.</li>
163
- <li>Stub methods with a prepended method if there are other prepended methods. Thanks to @mrsimo.</li>
164
- <li>Improve docs for <code>Mock#responds_like</code> &amp; <code>#responds_like_instance_of</code>.</li>
165
- <li>Use GitHub convention for instructions on contributing to Mocha.</li>
166
- <li>Fix typos in docs. Thanks to @10io</li>
167
- </ul>
168
-
169
- <h2>1.0.0</h2>
170
-
171
- <h3>External changes</h3>
172
-
173
- <ul>
174
- <li>Assume &#39;mocha&#39; has been required when requiring &#39;mocha/setup&#39;.</li>
175
- <li>Provide shortcuts for integrating with specific test library i.e. <code>require &#39;mocha/test_unit&#39;</code> or <code>require &#39;mocha/mini_test&#39;</code>
176
- as alternatives to <code>require &#39;mocha/setup&#39;</code>.</li>
177
- <li>Do not automatically try to integrate with test libraries. Since the automatic test library integration functionality
178
- requires the test library to be loaded and this doesn&#39;t usually happen until <em>after</em> the bundle is loaded, it makes things
179
- simpler if we use <code>require &#39;mocha/setup&#39;</code> to explicitly setup Mocha when we know the test library has been loaded. Fixes #146 &amp; #155.</li>
180
- <li>Consider stubs on superclasses if none exist on primary receiver. Largely based on changes suggested by @ccutrer in #145.
181
- Note: this may break existing tests which rely on the old behaviour. Stubbing a superclass method and then invoking that
182
- method on a child class would previously cause an unexpected invocation error. By searching up through the inheritance
183
- hierarchy for each of the delegate mock objects, we can provide more intuitive behaviour. Instead of an unexpected invocation
184
- error, invoking the method on the child class will cause the stubbed method on the superclass to be used.</li>
185
- <li>Avoid recursion when constructing unexpected invocation message. Fixes #168.</li>
186
- <li>Add explanation of method dispatch. Heavily based on the relevant jMock v1 documentation. Fixes #172.</li>
187
- <li>Make class_eval line number more accurate. This sets the line number as the line number of the <code>def</code> statement. Closes #169.</li>
188
- <li>Allow nesting of <code>responds_with</code> parameter matcher. Closes #166.</li>
189
- <li>Define <code>Mocha</code> module before it&#39;s referenced. The test helper defines a class <code>TestCase</code> within the <code>Mocha</code> module. When
190
- running the tests inside the bundle, the <code>Mocha</code> module happens to be defined at this point. However when running the tests outside the bundle, it is not defined and so an exception is raised: <code>uninitialized constant Mocha (NameError)</code>. Fixes #163.</li>
191
- <li>Document lack of thread-safety. Fixes #154.</li>
192
- <li>Document how to use the build-matrix script. Fixes #160.</li>
193
- <li>Stubbing non-public method should use same visibility. This will probably break some existing tests that were somehow relying
194
- on the stubbed method being public while the original method was protected or private. Fixes #150.</li>
195
- </ul>
196
-
197
- <h3>Internal changes</h3>
198
-
199
- <ul>
200
- <li>Use lastest Rubygems in Travis CI builds.</li>
201
- <li>Run the standard test suite against Ruby 2.1.0 in the build matrix.</li>
202
- <li>Run integration tests against Ruby 2.0.0 with latest Test::Unit gem in the build matrix.</li>
203
- <li>Test::Unit is not available in Ruby v1.9.3 standard library, so remove it from the build matrix.</li>
204
- <li>Force use of Test::Unit runner, etc in relevant integration tests. Prior to this, I don&#39;t think we were really testing the
205
- Mocha integration with Test::Unit much, because, although <code>TestUnitTest</code> was a subclass of <code>Test::Unit::TestCase</code>, the
206
- important test case instances are the temporary ones built by <code>TestRunner#run_as_test</code> et al. Prior to this change, these
207
- would only have used Test::Unit where MiniTest was not available <em>at all</em> i.e. only in early versions of Ruby and when the
208
- MiniTest gem was not loaded.</li>
209
- <li>Reset environment variables between build matrix builds.</li>
210
- <li>Only activate integration with relevant test library for each of the integration tests.</li>
211
- <li>Include standard build combinations from Travis CI config i.e. builds using standard library versions of test libraries.</li>
212
- <li>Fix <code>build-matrix.rb</code> script. Also use <code>.travis.yml</code> to decide what combinations to run. This means we
213
- can now simulate the Travis CI build locally and avoid duplication. Fixes #157.</li>
214
- <li>Remove Ruby version map from build matrix script. I&#39;m using the <code>rbenv-aliases</code> plugin to alias minor versions to the
215
- relevant patch version.</li>
216
- </ul>
217
-
218
- <h2>0.14.0</h2>
219
-
220
- <ul>
221
- <li>Official support for MiniTest v5. All tests now pass on the continuous integration build.</li>
222
- </ul>
223
-
224
- <h2>0.14.0.alpha</h2>
225
-
226
- <ul>
227
- <li>Add speculative support for Minitest v5. Due to incompatibilities it has not yet been possible to run the Mocha test suite against Minitest v5. However, @zenspider (author of Minitest) provided the patch and he has tested it against Rails v4. Fixes #156. Thanks to @zenspider.</li>
228
- <li>Documentation updates.</li>
229
- </ul>
230
-
231
- <h2>0.13.3</h2>
232
-
233
- <ul>
234
- <li>Allow <code>Mocha::ParameterMatchers#includes</code> to accept multiple items. Thanks to @simao.</li>
235
- <li>Allow stubbing of <em>private</em> <code>Kernel</code> methods. Fixes #134. Thanks to @camski for reporting.</li>
236
- <li>Avoid a warning when <code>test/unit/version</code> is required by other libraries in the same project. Fixes #140. Thanks to @tmiller.</li>
237
- <li>Make auto-activation of Test::Unit integration more resilient. This change is specifically to cope with the nasty re-defining of classes that is done by the <code>minitest-spec-rails</code> gem. Fixes #143. Thanks to @tubaxenor for reporting.</li>
238
- <li>Safer restoration of stubbed method visibility. Fixes #141. Thanks to @tmm1.</li>
239
- <li>Ensure <code>Mockery</code> instance gets reset even if exception raised. Fixes #144.</li>
240
- <li>Adapt Mocha acceptance tests to cope with changes in output from latest (v4.6.2) of MiniTest.</li>
241
- <li>Updates to README about Rails compatibility.</li>
242
- </ul>
243
-
244
- <h2>0.13.2</h2>
245
-
246
- <ul>
247
- <li>Stubbing of methods re-declared with different visibilty. Fixes #109.</li>
248
- <li>Add <code>Mock#responds_like_instance_of</code>. Fixes #119.</li>
249
- <li>Make <code>Expectation#inspect</code> less verbose and more useful. Fixes #122.</li>
250
- <li>Make unit tests more robust to changes in environment. Fixes #121.</li>
251
- <li>Update README in an attempt to head Rails-related issues off at the pass.</li>
252
- <li>Add a Gem Badge to provide a link to Mocha on Rubygems.</li>
253
- <li>Make documentation example consistent with other examples.</li>
254
- </ul>
255
-
256
- <h2>0.13.1</h2>
257
-
258
- <ul>
259
- <li>Fix #97 - <code>Mocha::ParameterMatchers#has_entry</code> does not work with an Array as the entry&#39;s value. Thanks to @ngokli.</li>
260
- <li>Allow deprecation <code>:debug</code> mode to be switched on from <code>MOCHA_OPTIONS</code> environment variable.</li>
261
- </ul>
262
-
263
- <h2>0.13.0</h2>
264
-
265
- <ul>
266
- <li>Major overhaul of MiniTest &amp; Test::Unit integration. Mocha now integrates with later versions of the two test libraries using documented hooks rather than monkey-patching. This should mean that Mocha will integrate with new versions of either library without the need to release a new version of Mocha each time, which was clearly bad and unsustainable. Many thanks to @tenderlove, @zenspider &amp; @kou for their help, suggestions &amp; patience.</li>
267
- <li>Temporarily deprecated <code>require &#39;mocha&#39;</code>. Use <code>require &#39;mocha/setup&#39;</code> instead. The plan is that eventually <code>require &#39;mocha&#39;</code> will <em>not</em> automatically integrate with either of the two test libraries as it does at the moment, and you&#39;ll need to explicitly &amp; separately trigger the integration. I think this will provide a lot more flexibility and will hopefully do away with the need for the <code>require: false</code> option in the <code>Gemfile</code> which has always confused people.</li>
268
- <li>Deprecated <code>require &#39;mocha_standalone&#39;</code> and <code>require &#39;mocha/standalone&#39;</code>. Use <code>require &#39;mocha/api</code> instead.</li>
269
- <li>Although these are not part of Mocha&#39;s public API, I thought I should mention that the MiniTest and Test::Unit assertion counter classes have been combined into a single class <code>Mocha::Integration::AssertionCounter</code>.</li>
270
- <li>Extracted Mocha::Hooks module from Mocha::API and added documentation for test library authors.</li>
271
- <li>Improvements to documentation. Much of it has been combined into the README file.</li>
272
- <li>Fix #101 - Mock#respond_to? doesn&#39;t work with a string argument - thanks to @urbanautomaton.</li>
273
- <li>Fix #105 - Travis link in README - thanks to @cknadler.</li>
274
- <li>Various improvements to automated testing of integration with test libraries.</li>
275
- <li>Make deprecation warnings more prominent.</li>
276
- </ul>
277
-
278
- <h2>0.12.7</h2>
279
-
280
- <ul>
281
- <li>Officially support minitest v4.1.0 (still monkey-patching).</li>
282
- </ul>
283
-
284
- <h2>0.12.6</h2>
285
-
286
- <ul>
287
- <li>Fixes #103.</li>
288
- </ul>
289
-
290
- <h2>0.12.5</h2>
291
-
292
- <ul>
293
- <li>Officially support minitest v3.5.0 (still monkey-patching).</li>
294
- </ul>
295
-
296
- <h2>0.12.4</h2>
297
-
298
- <ul>
299
- <li>Officially support minitest v3.4.0 &amp; test-unit v2.5.2 (still monkey-patching).</li>
300
- </ul>
301
-
302
- <h2>0.12.3</h2>
303
-
304
- <ul>
305
- <li>Revert rename of undocumented internal module since it turns out Rails/ActiveSupport is relying on its existence.</li>
306
- </ul>
307
-
308
- <h2>0.12.2</h2>
309
-
310
- <ul>
311
- <li>Officially support minitest v3.3.0 (still monkey-patching)</li>
312
- </ul>
313
-
314
- <h2>0.12.1</h2>
315
-
316
- <ul>
317
- <li>Deprecation warning (instead of fail fast) if neither Test::Unit nor MiniTest is loaded. Fixes #88.</li>
318
- <li>Remove deprecated access to <code>Mocha::Standalone</code>.</li>
319
- <li>Remove the deprecated file <code>stubba.rb</code>.</li>
320
- <li>Officially support test-unit v2.5.1 (still monkey-patching).</li>
321
- <li>Improve the API acceptance test.</li>
322
- </ul>
323
-
324
- <h2>0.12.0</h2>
325
-
326
- <ul>
327
- <li>Fail fast if neither Test::Unit nor MiniTest is loaded. Fixes #40.</li>
328
- <li>Officially support MiniTest up to v3.2.0 (still monkey-patching).</li>
329
- <li>Officially support test-unit v2.5.0 (still monkey-patching).</li>
330
- <li>Do not monkey-patch Test::Unit or MiniTest unless we <em>know</em> it&#39;s ok.</li>
331
- <li>Add acceptance tests to demonstrate using a block as a custom parameter matcher.</li>
332
- <li>Update Travis CI build status image to use the new build under the freerange account.</li>
333
- </ul>
334
-
335
- <h2>0.11.4</h2>
336
-
337
- <ul>
338
- <li>Homepage has moved to <a href="http://gofreerange.com/mocha/docs">http://gofreerange.com/mocha/docs</a>.</li>
339
- </ul>
340
-
341
- <h2>0.11.3</h2>
342
-
343
- <ul>
344
- <li>Fix for #78 i.e. alias Object#method as Object#<em>method, not Object#</em><em>method</em>_ which already exists as another Ruby method.</li>
345
- </ul>
346
-
347
- <h2>0.11.2</h2>
348
-
349
- <ul>
350
- <li>Rails has a Request class which defines its own #method method. This broke the new mechanism for stubbing a method. This release includes a slightly modified version of fix #77 provided by @sikachu. See <a href="https://github.com/rails/rails/pull/5907">https://github.com/rails/rails/pull/5907</a> for further info.</li>
351
- </ul>
352
-
353
- <h2>0.11.1</h2>
354
-
355
- <ul>
356
- <li>In Ruby 1.8.7 methods accepting a block parameter were incorrectly restored without the block parameter after being stubbed. Fix for #76.</li>
357
- </ul>
358
-
359
- <h2>0.11.0</h2>
360
-
361
- <ul>
362
- <li>Store original method when stubbing rather than using alias_method. This fixes #41, #47, #74 and all tests now pass on both Ruby 1.8.7 and 1.9.3.</li>
363
- <li>Attempting to stub a method on a frozen object should fail fast. See #68.</li>
364
- <li>Prevent stubbing a method on nil by default. See #68.</li>
365
- <li>Generate documentation using YARD instead of Rdoc - removes dependency on Coderay.</li>
366
- <li>Publish documentation on Github pages instead of Rubyforge - uses rake task written by @tomafro.</li>
367
- <li>Remove agiledox which has outlived it&#39;s usefulness.</li>
368
- <li>Removed trailing whitespace throughout codebase.</li>
369
- <li>Add documentation for Mock#unstub.</li>
370
- <li>Improve documentation for ObjectMethods.</li>
371
- <li>Provide a way to run multiple tests within a single acceptance test method.</li>
372
- </ul>
373
-
374
- <h2>0.10.5</h2>
375
-
376
- <ul>
377
- <li>Fix for issue #66 (hopefully without regressing on issue #63) - Mocha::Mock has Mocha::Mockery as a dependency. Stop trying to pretend otherwise. Thanks to @kennyj for reporting.</li>
378
- <li>Fix a bunch of warnings in Ruby 1.9. There are still the 6 test failures mentioned in issue #41 which I suspect are due to the introspection gem not being Ruby 1.9-compatible.</li>
379
- <li>Add links to README for source code &amp; issue tracker.</li>
380
- <li>Fix for issue #67 - Make the travis-ci badge visible in the README. Thanks to Diego Plentz for pull request.</li>
381
- <li>Fix for issue #70 - Rename Mock#expectations to Mock#<strong>expectations</strong> to avoid conflicts. Thanks to Jeremy Stephens for pull request.</li>
382
- </ul>
383
-
384
- <h2>0.10.4</h2>
385
-
386
- <ul>
387
- <li>Fix for issue #65 - expectations not being verified in subsequent tests.</li>
388
- <li>Fix for issue #63 - require Mocha::Mockery at Mocha::Mock class load time and not on invocation of Mock#method_missing.</li>
389
- <li>Fix for issue #45 - raise ArgumentError if Mocha::ParameterMatchers#has_entry is given
390
- Hash with wrong number of entries.</li>
391
- <li>Make global variable name more obscure to avoid clashes with other libraries.</li>
392
- <li>Move travis-ci-related gemfiles into their own directory.</li>
393
- </ul>
394
-
395
- <h2>0.10.3</h2>
396
-
397
- <ul>
398
- <li>Fix for issue #57. Gem::Requirement#=~ was only added in rubygems v1.8.0, but Object#=~ means the result of various monkey-patching checks is always false/nil for earlier versions of rubygems. However, the method it aliases #satisfied_by? has existed since Gem::Dependency was extracted from Gem::Version in rubygems v0.9.4.4, so it&#39;s much safer to use that. Thanks to fguillen for reporting and helping with diagnosis.</li>
399
- </ul>
400
-
401
- <h2>0.10.2</h2>
402
-
403
- <ul>
404
- <li>Merge pull request #53. Unstubbing a method should not remove expectations for other stubbed methods. Fixes #52. Thanks to saikat.</li>
405
- </ul>
406
-
407
- <h2>0.10.1</h2>
408
-
409
- <ul>
410
- <li>Merge pull request #51. Use Gem::Requirement &amp; Gem::Version for version comparison. Fixes issue #50. Thanks to meineerde.</li>
411
- <li>Fixed typo in rdoc for Mocha::ObjectMethods.</li>
412
- <li>Improve README as suggested in issue #46. Explain that Mocha must be loaded after test libraries and how to achieve this using Bundler.</li>
413
- <li>Merge pull request #43 - nobody expects the spanish inquisition! Thanks to cairo140.</li>
414
- <li>Fix for issue #39 - improve documentation for Expectation#multiple_yields.</li>
415
- <li>Fix for issue #38 where a subtle change in test-unit v2.3.0 had been missed - only visible in verbose mode.</li>
416
- <li>Support for MiniTest up to v2.6.2 has been verified.</li>
417
- <li>Add explicit development dependency on coderay for generating syntax-highlighted code examples.</li>
418
- </ul>
419
-
420
- <h2>0.10.0</h2>
421
-
422
- <ul>
423
- <li>Add Expectation#throws to allow a stubbed method to use Kernel#throw.</li>
424
- <li>Updates for versions of Test::Unit up to and including v2.3.3 (including patch by Jens Fahnenbruck).</li>
425
- <li>Updates for versions of MiniTest up to and including v2.5.1.</li>
426
- <li>Since the singleton method added by Mocha masks the underlying instance method, there&#39;s no need to move it out the way and then back again. This fixes Github issue #20, because the original method is left unchanged - <a href="https://github.com/floehopper/mocha/issues/20">https://github.com/floehopper/mocha/issues/20</a> (thanks to Nick Lewis).</li>
427
- <li>Handle stubbing of a singleton method, leaving the original method unchanged after the test.</li>
428
- <li>When stubbing an instance method that was originally defined as a singleton method, the original method should still exist after the test.</li>
429
- <li>Fixed mis-print in Mocha::ObjectMethods#unstub documentation (patch by Gleb Pomykalov).</li>
430
- <li>Improved test coverage around stubbing of methods defined in different ways - this makes use of the newly extracted introspection gem (although this means some tests are now failing in Ruby v1.9.2).</li>
431
- <li>Added configuration for Travis continuous integration.</li>
432
- <li>Make the gemspec the canonical reference and stop generating it from the Rakefile.</li>
433
- <li>Use the built-in Bundler rake tasks for packaging the gem.</li>
434
- <li>Use the &quot;release&quot; rake task provided by Bundler instead of using the Rake::XForge::Release functionality.</li>
435
- <li>Extract Object#<strong>metaclass</strong> into a new metaclass gem.</li>
436
- <li>Run rake tasks without <code>bundle exec</code>.</li>
437
- <li>Avoid deprecation warning for rdoc rake task.</li>
438
- <li>Remove the <code>use_test_unit_gem</code> MOCHA_OPTION which hasn&#39;t worked since we switched to bundler - we can now run the tests specifying a different Gemfile instead.</li>
439
- <li>Use multiple Gemfiles seems to run Travis CI builds against multiple version of test-unit &amp; minitest.</li>
440
- </ul>
441
-
442
- <h2>0.9.12</h2>
443
-
444
- <ul>
445
- <li>Make Mocha&#39;s tests pass under Ruby 1.9.2 i.e. using MiniTest. One of the main issues was that we were not parsing stacktraces on MiniTest errors comprehensively enough.</li>
446
- <li>Avoid &#39;circular require considered harmful&#39; warning when running Mocha&#39;s tests in Ruby 1.9.2</li>
447
- <li>Make performance tests work on Ruby 1.9.2 i.e. using MiniTest.</li>
448
- <li>Declare rake as a <em>development</em> dependency with newer versions of Rubygems since it&#39;s only needed to carry out developer-related tasks.</li>
449
- </ul>
450
-
451
- <h2>0.9.11</h2>
452
-
453
- <ul>
454
- <li>Added explicit support for minitest v1.5.0 to v2.0.2.</li>
455
- <li>Make testable by rubygems-test.</li>
456
- <li>Update links to my blog and make other links consistent.</li>
457
- <li>Added a URI parameter matcher that ignores the order of query parameters so that tests can be independent of undefined hash ordering (patch by Paul Battley).</li>
458
- <li>Include unexpected invocation in failure message and change the language slightly to make the failure message less confusing. See <a href="http://floehopper.lighthouseapp.com/projects/22289/tickets/52">http://floehopper.lighthouseapp.com/projects/22289/tickets/52</a>.</li>
459
- <li>No need to create regular expression every time the BacktraceFilter#filtered method is called. See <a href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/66">http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/66</a>.</li>
460
- </ul>
461
-
462
- <h2>0.9.10</h2>
463
-
464
- <ul>
465
- <li>Added Mocha::ObjectMethods#unstub method - <a href="https://github.com/floehopper/mocha/issues#issue/6">https://github.com/floehopper/mocha/issues#issue/6</a></li>
466
- <li>Inherit Mocha::ExpectationError from Exception instead of StandardError to reduce the chances of a test passing by accident - thanks to James Sanders (jsanders) - <a href="https://github.com/floehopper/mocha/issues#issue/15">https://github.com/floehopper/mocha/issues#issue/15</a></li>
467
- <li>Fixed bug - GitHub README page to link correctly to code examples - <a href="https://github.com/floehopper/mocha/issues/closed#issue/11">https://github.com/floehopper/mocha/issues/closed#issue/11</a></li>
468
- <li>Fixed bug - PASSTHROUGH_EXCEPTIONS are defined on MiniTest::Unit::TestCase not in Mocha - thanks to Brian Troutwine (blt) - <a href="https://github.com/floehopper/mocha/issues/closed#issue/14">https://github.com/floehopper/mocha/issues/closed#issue/14</a></li>
469
- </ul>
470
-
471
- <h2>0.9.9</h2>
472
-
473
- <ul>
474
- <li>Avoid loading bits of the test-unit gem by accident. This is an attempt at a fix for the problem that James Adam reported [1]. By using &#39;load&#39; instead of &#39;require&#39; to detect the version of Test::Unit, we can avoid rubygems trying to load bits of the test-unit gem when it&#39;s not wanted. [1] <a href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50#ticket-50-13">http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50#ticket-50-13</a></li>
475
- <li>Fix exception when running rake without test-unit gem. When test-unit gem &gt;=v2.0.0 was installed but the &quot;use_test_unit_gem&quot; MOCHA_OPTIONS was not specified, a &quot;comparison of Fixnum with Hash failed&quot; exception was being raised when running the performance tests. This was because bits of the test-unit gem were being loaded accidentally and a Hash was being incorrectly supplied to the TestRunner.run method.</li>
476
- <li>Explicitly require rubygems for running tests via rake using test-unit gem.</li>
477
- <li>Handle newer versions of test-unit gem (v2.0.2 to v2.0.9)</li>
478
- <li>Handle newer versions of minitest gem (v1.4.0 to v1.6.0)</li>
479
- <li>Added warnings about monkey-patching test-unit and minitest to aid debugging. These are enabled by including &quot;debug&quot; in the MOCHA_OPTIONS environment variable. This is now a comma-separated list, so that we can specify multiple options e.g. MOCHA_OPTIONS=debug,use_test_unit_gem</li>
480
- <li>Eloy Duran (alloy) made the unit tests run on 1.9.2dev r25249.</li>
481
- <li>Eloy Duran (alloy) also improved some MiniTest TestResult code I&#39;d written and got the acceptance tests running on Ruby 1.9 HEAD. There are still 4 failures because for some reason the backtrace line numbers are off by one. And the minitest_test test case does not run when the whole suite is run with MiniTest. These issues still need investigation.</li>
482
- <li>Fixed some acceptance tests to run in Ruby 1.9.2 - it&#39;s no longer possible to subvert the protection of a method by calling it via Object#send.</li>
483
- <li>Fixed &quot;test:performance&quot; rake task so it runs in Ruby 1.9.2.</li>
484
- <li>Fix test incorrectly failing under Rubinius 1.0. This test imposed too many constraints. It appears that Object#inspect legitimately calls Object#object_id in Rubinius. But we&#39;re only interested in what &#39;id&#39; methods Mocha::ObjectMethods#mocha_inspect calls. By stubbing Object#inspect we can relax the constraints imposed by the test.</li>
485
- <li>Luke Redpath (lukeredpath) added new shorthand &quot;any&quot; and &quot;all&quot; composite parameter matchers using &quot;&amp;&quot; and &quot;|&quot;. This provides an alternative syntax for expecting any or all matchers to pass, e.g. foo.expects(:bar).with(equals(1) | equals(2)).</li>
486
- <li>Improved documentation for Expectation#raises. A number of people have suggested an extension to the API to cope with custom exceptions that have extra constructor parameters. However, since the arguments supplied to Expectation#raises are just passed on to Kernel#raise, it&#39;s possible to pass in an instance of an exception. Thus no change to the API is required, but it does seem worthwhile pointing this out in the docs.</li>
487
- <li>Corrected RDoc example for Expectation#never thanks to Red David (reddavis).</li>
488
- <li>Improved RDoc including a change suggested by Rohit Arondekar (rohit).</li>
489
- <li>Updated gemspec as requested by Sam Woodard (shwoodard).</li>
490
- </ul>
491
-
492
- <h2>0.9.8</h2>
493
-
494
- <ul>
495
- <li>Fixed bug &quot;NameError raised when using Mocha as a Rails plug-in&quot; - <a href="http://floehopper.lighthouseapp.com/projects/22289/tickets/53">http://floehopper.lighthouseapp.com/projects/22289/tickets/53</a>. Since 0.9.6 the Rails plugin has been broken. See bug report for details. You will need to explicitly load Mocha <em>after</em> the test framework has been loaded, e.g. by adding &quot;require &#39;mocha&#39;&quot; at the bottom of test/test_helper.rb.</li>
496
- <li>Make Mocha::ParameterMatchers#regexp_matches, #includes, #has_value, #has_key more robust. Thanks to Sander Hartlage.</li>
497
- <li>Allow passing a block to Mocha::Configuration methods to only change configuration for the duration of the block. Thanks to Dan Manges.</li>
498
- <li>Fixed bug &quot;doc generation fails in 0.9.7 gem&quot; - <a href="http://floehopper.lighthouseapp.com/projects/22289/tickets/51">http://floehopper.lighthouseapp.com/projects/22289/tickets/51</a>.</li>
499
- <li>Remove rdoc template incorporating google analytics from source control. The file just needs to exist locally and be ignored by source control. This should stop the warning showing up on e.g. RunCodeRun build results.</li>
500
- </ul>
501
-
502
- <h2>0.9.7</h2>
503
-
504
- <ul>
505
- <li>Although I had provided a deprecation warning for people using Mocha::Standalone, I had assumed people wouldn&#39;t be explicitly loading the mocha/standalone.rb file. It turns out this assumption was incorrect at least in the case of Rspec. This is now fixed.</li>
506
- </ul>
507
-
508
- <h2>0.9.6</h2>
509
-
510
- <ul>
511
- <li>Version 2.0.1 of the test-unit gem introduced a private &#39;run_test&#39; method on TestCase which clashed with the public TestRunner#run_test method. So this latter method has been renamed to &#39;run_as_test&#39;.</li>
512
- <li>Stop requiring rubygems - this should be an environmental choice for the user. <a href="http://gist.github.com/54177">http://gist.github.com/54177</a> - describes why requiring rubygems in your library code is a bad idea.</li>
513
- <li>It seems like overkill to vendorize coderay and meta_project when they&#39;re only needed to generate the examples for documentation and for publishing files on RubyForge. So I&#39;m removing them and installing them locally as gems when I need them.</li>
514
- <li>Added support for &#39;test-unit&#39; gem (version &gt;= 2.0). Note that as with other versions of Test::Unit I&#39;m completely replacing the TestCase#run method. Unfortunately in version 2.0.0 this method differs slightly from the same method in version 2.0.1 &amp; 2.0.2, so we have to provide different implementations to ensure that the internal working of Test::Unit are not compromised by Mocha. Note also that unless the &#39;test-unit&#39; gem is loaded, requiring &#39;test/unit&#39; leads to a mixture of stdlib and gem classes being loaded causing errors. To avoid a dependency on rubygems, the gem is loaded only if MOCHA_OPTIONS is set to &#39;use_test_unit_gem&#39; - this option is only intended for use in running Mocha&#39;s own tests. It might be worthwhile to create a shim gem like minitest_tu_shim to allow the test-unit gem to completely replace the stdlib, but that&#39;s a job for another day. The changes in the Rakefile are to make the default task run with the &#39;test-unit&#39; gem (version &gt;= 2.0).</li>
515
- <li>Renamed Mocha::Standalone to Mocha::API to better reflect its purpose. Added a deprecation warning for those who are referencing Mocha::Standalone.</li>
516
- <li>Fix exception raised by HasEntry#matches? if first param is not a Hash (thanks to Taylor Barstow).</li>
517
- <li>Ken Collins reported [1] that Mocha is always loading MiniTest if it is available and loading it causes some Rails/ActionPack tests to break. I&#39;ve removed the loading of MiniTest, but this now means the user has to ensure that if they want to use MiniTest in conjunction with Mocha, he must load MiniTest before loading Mocha. [1] <a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2060">http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2060</a></li>
518
- <li>Implemented Bacon integration (thanks to Ubiratan Pires Alberton), but this was then removed after deciding only to maintain integration with Test::Unit and MiniTest which are both Ruby standard libraries. See mailing list for details.</li>
519
- <li>Don&#39;t monkey-patch MiniTest if it&#39;s already been monkey-patched by Mocha.</li>
520
- <li>Fixed bug: MiniTest integration was counting ExpectationErrors as errors not failures. <a href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/41">http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/41</a>.</li>
521
- <li>Fixed bug: Some Bacon tests were failing in Ruby 1.9.1. <a href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/43">http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/43</a>.</li>
522
- <li>Chad Humphries pointed out that in Ruby 1.9.1, if you are not using Test::Unit or MiniTest, Mocha will attempt to load and monkey-patch Test::Unit. Mocha will now only monkey-patch Test::Unit and/or MiniTest if they have already been loaded. MiniTest tests will now run in both Ruby 1.8.6 (with MiniTest gem) and in Ruby 1.9.1 (with MiniTest std lib). See Ligthouse ticket - <a href="http://floehopper.lighthouseapp.com/projects/22289/tickets/49">http://floehopper.lighthouseapp.com/projects/22289/tickets/49</a>.</li>
523
- <li>Made Mocha compatible with minitest 1.4.0 and above (thanks to Denis Defreyne).</li>
524
- </ul>
525
-
526
- <h2>0.9.5</h2>
527
-
528
- <ul>
529
- <li>Fixed Lighthouse bug #32 - stub_everything should mean mock responds to anything.</li>
530
- <li>Added Expectation#twice to improve readability. Thanks to pull request from Celestino Gomes.</li>
531
- <li>In Ruby 1.9.1, requiring &#39;test/unit&#39; loads a thin wrapper around MiniTest and Test::Unit::TestCase ends up inheriting from MiniTest::Unit::TestCase. So we need to avoid including the Mocha modules more than once to avoid nasty consequences. Thanks to Matthias Hennemeyer for help with this.</li>
532
- <li>Ruby 1.9 includes rake, but not rake/contrib. For the moment I&#39;ve moved the sshpublisher require into the only rake task that needs it, so that I can at least run the tests in Ruby 1.9. It looks like I will need to build a rake/contrib gem or similar to get this working properly - <a href="http://intertwingly.net/blog/2008/01/07/Rake-Contrib-for-1-9">http://intertwingly.net/blog/2008/01/07/Rake-Contrib-for-1-9</a></li>
533
- </ul>
534
-
535
- <h2>0.9.4</h2>
536
-
537
- <ul>
538
- <li>Added mocha.gemspec file generated with Chad Woolley&#39;s new rake task, so that a floehopper-mocha gem will get built on GitHub.</li>
539
- <li>Add rake task to update mocha.gemspec with unique version, which will cause gem to be auto-built on github</li>
540
- <li>As Tobias Crawley correctly pointed out in feature request #23055 &quot;stubs(with_hash) not working with existing object&quot; [1], following the principle of least surprise, it should be possible to call ObjectMethods#expects &amp; ObjectMethods#stubs with a Hash of method_names vs return_values like you can with Mock#expects &amp; Mock#stubs. I&#39;ve also updated &amp; improved the docs to reflect the changes. [1] <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=23055&group_id=1917&atid=7480">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=23055&amp;group_id=1917&amp;atid=7480</a></li>
541
- <li>Removed deprecated gem autorequire.</li>
542
- </ul>
543
-
544
- <h2>0.9.3</h2>
545
-
546
- <ul>
547
- <li>Added support for MiniTest thanks to Jeff Smick.</li>
548
- <li>Fixed a possible bug with some of the non-default Configuration options relating to the argument to Object#respond_to?</li>
549
- <li>As per Jay Fields recommendations [1] and with further impetus from a talk at Ruby Manor, any methods added to core classes are now added by including a module. This means that Mocha is a better citizen of the Ruby world and it&#39;s behaviour is more easily extended. [1] <a href="http://blog.jayfields.com/2008/07/ruby-underuse-of-modules.html">http://blog.jayfields.com/2008/07/ruby-underuse-of-modules.html</a> &amp; <a href="http://blog.jayfields.com/2008/07/ruby-redefine-method-behavior.html">http://blog.jayfields.com/2008/07/ruby-redefine-method-behavior.html</a></li>
550
- <li>Removed deprecated gem autorequire.</li>
551
- </ul>
552
-
553
- <h2>0.9.2</h2>
554
-
555
- <ul>
556
- <li>Improved documentation to address [#22530] &#39;Mock methods with multiple return values not possible?&#39;</li>
557
- <li>respond_with parameter matcher was not available in tests.</li>
558
- <li>Patch [#22630] Fix for a bug in running Rails tests with Ruby 1.8.7. Array#flatten was being called which in turn was checking whether each element responded to #to_ary. This check was using the two parameter version of #respond_to?, but Mock was only defining a one parameter version.</li>
559
- </ul>
560
-
561
- <h2>0.9.1</h2>
562
-
563
- <ul>
564
- <li>Fixed bug #21465 - expects &amp; stubs should support method names as strings (as well as symbols) or fail fast. Convert all expectation method names to a symbol in case they were supplied as a string.</li>
565
- <li>By removing Mock#unexpected_method_called we reduce the number of methods vulnerable to the problem that surfaced in bug #21563.</li>
566
- <li>Fix bug #21563 - stubbing &#39;verified?&#39; method is unsafe. Instance method names on the Mock class should be more obscure.</li>
567
- <li>Performance improvement. StubbaExampleTest goes twice as fast on my local machine.</li>
568
- <li>Added primitive performance test to default rake task.</li>
569
- <li>Fix format of case statements which don&#39;t work in Ruby 1.9 and make others consistent.</li>
570
- <li>There is no point in running (potentially expensive) checks if configuration is set to allow such checks to fail. This is a relatively quick fix in response to Chris McGrath&#39;s performance problems.</li>
571
- <li>Fix for bug #21161 - &#39;uninitialized constant Deprecation in stubba.rb&#39;.</li>
572
- <li>It&#39;s more readable to talk about &#39;once&#39; and &#39;twice&#39; rather than &#39;1 time&#39; and &#39;2 times&#39;.</li>
573
- <li>Fix bug #20883 - never should raise when called to prevent follow up errors. Fail fast when there are no matching invokable expectations and handle the stub_everything case sensibly. This might not be entirely backwards compatible, but I think the benefits outweigh the risks. The most likely change is that a test that was already failing will now fail faster, which doesn&#39;t seem so awful.</li>
574
- </ul>
575
-
576
- <h2>0.9.0</h2>
577
-
578
- <ul>
579
- <li><p>Configurable warnings or errors</p>
580
-
581
- <ul>
582
- <li>when a method on a non-public method is stubbed</li>
583
- <li>when a method on a non-existent method is stubbed</li>
584
- <li>when a method on a non-mock object is stubbed</li>
585
- <li>when a method is stubbed unnecessarily (i.e. the stubbed method is not called during the test)</li>
586
- </ul></li>
587
- <li><p>Improved error messages</p>
588
-
589
- <ul>
590
- <li>User-friendly list of unsatisfied expectations, satisfied expectations and state machines.</li>
591
- <li>Improved readability of cardinality description.</li>
592
- <li>Display sensible failure message for any_instance expectations e.g. &quot;#<a href="AnyInstance:Foo">AnyInstance:Foo</a>.bar - expected calls: 1, actual calls: 0&quot;</li>
593
- </ul></li>
594
- <li><p>Parameter matchers</p>
595
-
596
- <ul>
597
- <li>New to this release</li>
598
- <li>optionally (allows matching of optional parameters if available)</li>
599
- <li>yaml_equivalent (allows matching of YAML that represents the specified object)</li>
600
- <li>responds_with (tests the quack not the duck)</li>
601
- <li>Nesting of parameter matchers is now supported.</li>
602
- </ul></li>
603
- <li><p>Optional block passed into mock initializer is evaluated in the context of the new mock instance and can be used as a shortcut to set up expectations.</p></li>
604
- <li><p>Added JMock-style sequences for constraining the order of expected invocations. See Standalone#sequence and Expectation#in_sequence.</p></li>
605
- <li><p>Added JMock-style states for constraining the order of expected invocations. See Standalone#states, Expectation#then, Expectation#when and StateMachine.</p></li>
606
- <li><p>Compatibility with versions of Ruby</p>
607
-
608
- <ul>
609
- <li>Compatibility with Ruby v1.9. All test errors and warnings fixed.</li>
610
- <li>Nasty fix so that TestCaseAdaptor works consistently with earlier versions of Test::Unit as well as more recent versions.</li>
611
- <li>Added platform to gem specification to avoid bug in rubygems 0.9.5 - see <a href="http://www.dcmanges.com/blog/rubygems-0-9-5-platform-bug">http://www.dcmanges.com/blog/rubygems-0-9-5-platform-bug</a> and <a href="http://rubygems.org/read/chapter/20#platform">http://rubygems.org/read/chapter/20#platform</a>.</li>
612
- <li>Make ExpectationRaiser deal with subclasses of Interrupt which seem to need a message supplied in the raise statement in Ruby 1.8.6 (but not 1.8.4 or 1.9). Not sure this is really Mocha&#39;s responsibility.</li>
613
- </ul></li>
614
- <li><p>Added deprecation warning in stubba.rb which is no longer needed and will be removed.</p></li>
615
- <li><p>Supply positioning information to evals to improve any error messages. See <a href="http://ola-bini.blogspot.com/2008/01/ruby-antipattern-using-eval-without.html">http://ola-bini.blogspot.com/2008/01/ruby-antipattern-using-eval-without.html</a></p></li>
616
- <li><p>Bug fixes</p>
617
-
618
- <ul>
619
- <li>18914 in revision 296 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=18914&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=18914&amp;group_id=1917&amp;atid=7477</a></li>
620
- <li>18917 in revision 295 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=18917&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=18917&amp;group_id=1917&amp;atid=7477</a></li>
621
- <li>18336 in revision 287 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=18336&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=18336&amp;group_id=1917&amp;atid=7477</a></li>
622
- <li>17835 in revision 255 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=17835&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=17835&amp;group_id=1917&amp;atid=7477</a></li>
623
- <li>17412 in revision 242 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=17412&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=17412&amp;group_id=1917&amp;atid=7477</a></li>
624
- <li>15977 in revision 198 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=15977&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=15977&amp;group_id=1917&amp;atid=7477</a></li>
625
- <li>11885 in revision 156 - <a href="http://rubyforge.org/tracker/index.php?func=detail&aid=11885&group_id=1917&atid=7477">http://rubyforge.org/tracker/index.php?func=detail&amp;aid=11885&amp;group_id=1917&amp;atid=7477</a></li>
626
- </ul></li>
627
- </ul>
628
-
629
- <h2>0.5.5</h2>
630
-
631
- <ul>
632
- <li>Renamed Matches parameter matcher to RegexpMatches for clarity.</li>
633
- <li>Added noframes tag to rdoc index to assist Google.</li>
634
- </ul>
635
-
636
- <h2>0.5.4</h2>
637
-
638
- <ul>
639
- <li>Added matches parameter matcher for matching regular expressions.</li>
640
- </ul>
641
-
642
- <h2>0.5.3</h2>
643
-
644
- <ul>
645
- <li>Attempt to fix packaging problems by switching to newer version (1.15.1) of gnutar and setting COPY_EXTENDED_ATTRIBUTES_DISABLE environment variable.</li>
646
- <li>Removed unused ExpectationSequenceError exception.</li>
647
- <li>Added instance_of and kind_of parameter matchers.</li>
648
- <li>Added Google Webmaster meta tag to rdoc template header.</li>
649
- <li>Put Google Webmaster meta tag in the right header i.e. the one for the index page.</li>
650
- </ul>
651
-
652
- <h2>0.5.2</h2>
653
-
654
- <ul>
655
- <li>Fix bug 11885 - &quot;never doesn&#39;t work with stub_everything&quot; submitted by Alexander Lang. In fixing this bug, also fixed undiscoverd bug where expected &amp; actual invocation counts were being incorrectly reported which seems to have been introduced when fixes were added for invocation dispatch (see MockedMethodDispatchAcceptanceTest).</li>
656
- <li>Previously when an expectation did not allow more invocations, it was treated as not matching. Now we prefer matching expectations which allow more invocations, but still match expectations which cannot allow more invocations. I think this may be overcomplicating things, but let&#39;s see how it goes.</li>
657
- </ul>
658
-
659
- <h2>0.5.1</h2>
660
-
661
- <ul>
662
- <li>Fixed bug #11583 &quot;Mocha 0.5.0 throwing unexpected warnings&quot;. Also switched on ruby warning for all rake test tasks. Fixed majority of warnings, but some left to fix.</li>
663
- </ul>
664
-
665
- <h2>0.5.0</h2>
666
-
667
- <ul>
668
- <li>Parameter Matchers - I&#39;ve added a few Hamcrest-style parameter matchers which are designed to be used inside Expectation#with. The following matchers are currently available: anything(), includes(), has_key(), has_value(), has_entry(), all_of() &amp; any_of(). More to follow soon. The idea is eventually to get rid of the nasty parameter_block option on Expectation#with.</li>
669
- </ul>
670
-
671
- <p>object = mock()
672
- object.expects(:method).with(has_key(&#39;key_1&#39;))
673
- object.method(&#39;key_1&#39; =&gt; 1, &#39;key_2&#39; =&gt; 2)
674
- # no verification error raised</p>
675
-
676
- <p>object = mock()
677
- object.expects(:method).with(has_key(&#39;key_1&#39;))
678
- object.method(&#39;key_2&#39; =&gt; 2)
679
- # verification error raised, because method was not called with Hash containing key: &#39;key_1&#39;</p>
680
-
681
- <ul>
682
- <li>Values Returned and Exceptions Raised on Consecutive Invocations - Allow multiple calls to Expectation#returns and Expectation#raises to build up a sequence of responses to invocations on the mock. Added syntactic sugar method Expectation#then to allow more readable expectations.</li>
683
- </ul>
684
-
685
- <p>object = mock()
686
- object.stubs(:method).returns(1, 2).then.raises(Exception).then.returns(4)
687
- object.method # =&gt; 1
688
- object.method # =&gt; 2
689
- object.method # =&gt; raises exception of class Exception
690
- object.method # =&gt; 4</p>
691
-
692
- <ul>
693
- <li>Yields on Consecutive Invocations - Allow multiple calls to yields on single expectation to allow yield parameters to be specified for consecutive invocations.</li>
694
- </ul>
695
-
696
- <p>object = mock()
697
- object.stubs(:method).yields(1, 2).then.yields(3)
698
- object.method { |*values| p values } # =&gt; [1, 2]
699
- object.method { |*values| p values } # =&gt; [3]</p>
700
-
701
- <ul>
702
- <li>Multiple Yields on Single Invocation - Added Expectation#multiple_yields to allow a mocked or stubbed method to yield multiple times for a single invocation.</li>
703
- </ul>
704
-
705
- <p>object = mock()
706
- object.stubs(:method).multiple_yields([1, 2], [3])
707
- object.method { |*values| p values } # =&gt; [1, 2] # =&gt; [3]</p>
708
-
709
- <ul>
710
- <li>Invocation Dispatch - Expectations were already being matched in reverse order i.e. the most recently defined one was being found first. This is still the case, but we now stop matching an expectation when its maximum number of expected invocations is reached. c.f. JMock v1. A stub will never stop matching by default. Hopefully this means we can soon get rid of the need to pass a Proc to Expectation#returns.</li>
711
- </ul>
712
-
713
- <p>object = mock()
714
- object.stubs(:method).returns(2)
715
- object.expects(:method).once.returns(1)
716
- object.method # =&gt; 1
717
- object.method # =&gt; 2
718
- object.method # =&gt; 2
719
- # no verification error raised</p>
720
-
721
- <p># The following should still work...</p>
722
-
723
- <p>Time.stubs(:now).returns(Time.parse(&#39;Mon Jan 01 00:00:00 UTC 2007&#39;))
724
- Time.now # =&gt; Mon Jan 01 00:00:00 UTC 2007
725
- Time.stubs(:now).returns(Time.parse(&#39;Thu Feb 01 00:00:00 UTC 2007&#39;))
726
- Time.now # =&gt; Thu Feb 01 00:00:00 UTC 2007</p>
727
-
728
- <ul>
729
- <li>Deprecate passing an instance of Proc to Expectation#returns.</li>
730
- <li>Explicitly include all Rakefile dependencies in project.</li>
731
- <li>Fixed old Stubba example.</li>
732
- <li>Fix so that it is possible for a stubbed method to raise an Interrupt exception without a message in Ruby 1.8.6</li>
733
- <li>Added responds_like and quacks_like.</li>
734
- <li>Capture standard object methods before Mocha adds any.</li>
735
- <li>Added Expectation#once method to make interface less surprising.</li>
736
- <li>Use Rake::TestTask to run tests. Created three separate tasks to run unit, integration &amp; acceptance tests. Split inspect_test into one file per TestCase. Deleted superfluous all_tests file.</li>
737
- <li>Fiddled with mocha_inspect and tests to give more sensible results on x86 platform.</li>
738
- <li>Fixed bug #7834 &quot;infinite_range.rb makes incorrect assumption about to_f&quot; logged by James Moore.</li>
739
- </ul>
740
-
741
- <h2>0.4.0</h2>
742
-
743
- <ul>
744
- <li>Allow naming of mocks (patch from Chris Roos).</li>
745
- <li>Specify multiple return values for consecutive calls.</li>
746
- <li>Improved consistency of expectation error messages.</li>
747
- <li>Allow mocking of Object instance methods e.g. kind_of?, type.</li>
748
- <li>Provide aliased versions of #expects and #stubs to allow mocking of these methods.</li>
749
- <li>Added at_least, at_most, at_most_once methods to expectation.</li>
750
- <li>Allow expects and stubs to take a hash of method and return values.</li>
751
- <li>Eliminate warning: &quot;instance variable @yield not initialized&quot; (patch from Xavier Shay).</li>
752
- <li>Restore instance methods on partial mocks (patch from Chris Roos).</li>
753
- <li>Allow stubbing of a method with non-word characters in its name (patch from Paul Battley).</li>
754
- <li>Removed coupling to Test::Unit.</li>
755
- <li>Allow specified exception instance to be raised (patch from Chris Roos).</li>
756
- <li>Make mock object_id appear in hex like normal Ruby inspect (patch from Paul Battley).</li>
757
- <li>Fix path to object.rb in rdoc rake task (patch from Tomas Pospisek).</li>
758
- <li>Reverse order in which expectations are matched, so that last expectation is matched first. This allows e.g. a call to #stubs to be effectively overridden by a call to #expects (patch from Tobias Lutke).</li>
759
- <li>Stubba &amp; SmartTestCase modules incorporated into Mocha module so only need to require &#39;mocha&#39; - no longer need to require &#39;stubba&#39;.</li>
760
- <li>AutoMocha removed.</li>
761
- </ul>
762
-
763
- <h2>0.3.3</h2>
764
-
765
- <ul>
766
- <li>Quick bug fix to restore instance methods on partial mocks (for Kevin Clark).</li>
767
- </ul>
768
-
769
- <h2>0.3.2</h2>
770
-
771
- <ul>
772
- <li>Examples added.</li>
773
- </ul>
774
-
775
- <h2>0.3.1</h2>
776
-
777
- <ul>
778
- <li>Dual licensing with MIT license added.</li>
779
- </ul>
780
-
781
- <h2>0.3.0</h2>
782
-
783
- <ul>
784
- <li>Rails plugin.</li>
785
- <li>Auto-verify for expectations on concrete classes.</li>
786
- <li>Include each expectation verification in the test result assertion count.</li>
787
- <li>Filter out noise from assertion backtraces.</li>
788
- <li>Point assertion backtrace to line where failing expectation was created.</li>
789
- <li>New yields method for expectations.</li>
790
- <li>Create stubs which stub all method calls.</li>
791
- <li>Mocks now respond_to? expected methods.</li>
792
- </ul>
793
-
794
- <h2>0.2.1</h2>
795
-
796
- <ul>
797
- <li>Rename MochaAcceptanceTest::Rover#move method to avoid conflict with Rake (in Ruby 1.8.4 only?)</li>
798
- </ul>
799
-
800
- <h2>0.2.0</h2>
801
-
802
- <ul>
803
- <li>Small change to SetupAndTeardown#teardown_stubs suggested by Luke Redpath (<a href="http://www.lukeredpath.co.uk">http://www.lukeredpath.co.uk</a>) to allow use of Stubba with RSpec (<a href="http://rspec.rubyforge.org">http://rspec.rubyforge.org</a>).</li>
804
- <li>Reorganized directory structure and extracted addition of setup and teardown methods into SmartTestCase mini-library.</li>
805
- <li>Addition of auto-verify for Mocha (but not Stubba). This means there is more significance in the choice of expects or stubs in that any expects on a mock will automatically get verified.</li>
806
- </ul>
807
-
808
- <p>So instead of...</p>
809
-
810
- <p>wotsit = Mocha.new
811
- wotsit.expects(:thingummy).with(5).returns(10)
812
- doobrey = Doobrey.new(wotsit)
813
- doobrey.hoojamaflip
814
- wotsit.verify</p>
815
-
816
- <p>you need to do...</p>
817
-
818
- <p>wotsit = mock()
819
- wotsit.expects(:thingummy).with(5).returns(10)
820
- doobrey = Doobrey.new(wotsit)
821
- doobrey.hoojamaflip
822
- # no need to verify</p>
823
-
824
- <p>There are also shortcuts as follows...</p>
825
-
826
- <p>instead of...</p>
827
-
828
- <p>wotsit = Mocha.new
829
- wotsit.expects(:thingummy).returns(10)
830
- wotsit.expects(:summat).returns(25)</p>
831
-
832
- <p>you can have...</p>
833
-
834
- <p>wotsit = mock(:thingummy =&gt; 5, :summat =&gt; 25)</p>
835
-
836
- <p>and instead of...</p>
837
-
838
- <p>wotsit = Mocha.new
839
- wotsit.stubs(:thingummy).returns(10)
840
- wotsit.stubs(:summat).returns(25)</p>
841
-
842
- <p>you can have...</p>
843
-
844
- <p>wotsit = stub(:thingummy =&gt; 5, :summat =&gt; 25)</p>
845
-
846
- <h2>0.1.2</h2>
847
-
848
- <ul>
849
- <li>Minor tweaks</li>
850
- </ul>
851
-
852
- <h2>0.1.1</h2>
853
-
854
- <ul>
855
- <li>Initial release.</li>
856
- </ul>
857
- </div><script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
858
- <script>
859
- window.dataLayer = window.dataLayer || [];
860
- function gtag(){dataLayer.push(arguments);}
861
- gtag('js', new Date());
862
-
863
- gtag('config', 'UA-625523-7');
864
- </script>
865
- </div>
866
-
867
- <div id="footer">
868
- Generated on Tue Jan 15 17:13:05 2019 by
869
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
870
- 0.9.16 (ruby-2.5.3).
871
- </div>
872
-
873
- </div>
874
- </body>
875
- </html>