mocha 0.10.5 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/COPYING.rdoc +1 -1
  2. data/README.rdoc +6 -4
  3. data/RELEASE.rdoc +12 -0
  4. data/Rakefile +29 -60
  5. data/doc/Mocha.html +112 -0
  6. data/doc/Mocha/API.html +898 -0
  7. data/doc/Mocha/ClassMethods.html +246 -0
  8. data/doc/Mocha/Configuration.html +471 -0
  9. data/doc/Mocha/Expectation.html +2570 -0
  10. data/doc/Mocha/Mock.html +830 -0
  11. data/doc/Mocha/ObjectMethods.html +668 -0
  12. data/doc/Mocha/ParameterMatchers.html +2715 -0
  13. data/doc/Mocha/ParameterMatchers/AllOf.html +137 -0
  14. data/doc/Mocha/ParameterMatchers/AnyOf.html +137 -0
  15. data/doc/Mocha/ParameterMatchers/AnyParameters.html +136 -0
  16. data/doc/Mocha/ParameterMatchers/Anything.html +136 -0
  17. data/doc/Mocha/ParameterMatchers/Base.html +419 -0
  18. data/doc/Mocha/ParameterMatchers/Equals.html +137 -0
  19. data/doc/Mocha/ParameterMatchers/HasEntries.html +137 -0
  20. data/doc/Mocha/ParameterMatchers/HasEntry.html +137 -0
  21. data/doc/Mocha/ParameterMatchers/HasKey.html +137 -0
  22. data/doc/Mocha/ParameterMatchers/HasValue.html +137 -0
  23. data/doc/Mocha/ParameterMatchers/Includes.html +137 -0
  24. data/doc/Mocha/ParameterMatchers/InstanceOf.html +137 -0
  25. data/doc/Mocha/ParameterMatchers/IsA.html +136 -0
  26. data/doc/Mocha/ParameterMatchers/KindOf.html +137 -0
  27. data/doc/Mocha/ParameterMatchers/Not.html +137 -0
  28. data/doc/Mocha/ParameterMatchers/Optionally.html +136 -0
  29. data/doc/Mocha/ParameterMatchers/QueryStringMatches.html +136 -0
  30. data/doc/Mocha/ParameterMatchers/RegexpMatches.html +137 -0
  31. data/doc/Mocha/ParameterMatchers/RespondsWith.html +137 -0
  32. data/doc/Mocha/ParameterMatchers/YamlEquivalent.html +137 -0
  33. data/doc/Mocha/Sequence.html +133 -0
  34. data/doc/Mocha/StateMachine.html +510 -0
  35. data/doc/Mocha/StateMachine/State.html +125 -0
  36. data/doc/Mocha/StateMachine/StatePredicate.html +125 -0
  37. data/doc/Mocha/StubbingError.html +134 -0
  38. data/doc/Mocha/UnexpectedInvocation.html +124 -0
  39. data/doc/_index.html +481 -0
  40. data/doc/class_list.html +47 -0
  41. data/doc/css/common.css +1 -0
  42. data/doc/css/full_list.css +55 -0
  43. data/doc/css/style.css +322 -0
  44. data/doc/file.COPYING.html +72 -0
  45. data/doc/file.MIT-LICENSE.html +86 -0
  46. data/doc/file.README.html +153 -0
  47. data/doc/file.RELEASE.html +933 -0
  48. data/doc/file.misc.html +108 -0
  49. data/doc/file.mocha.html +90 -0
  50. data/doc/file.stubba.html +129 -0
  51. data/doc/file_list.html +67 -0
  52. data/doc/frames.html +13 -0
  53. data/doc/index.html +153 -0
  54. data/doc/js/app.js +205 -0
  55. data/doc/js/full_list.js +173 -0
  56. data/doc/js/jquery.js +16 -0
  57. data/doc/method_list.html +510 -0
  58. data/doc/top-level-namespace.html +105 -0
  59. data/lib/mocha/any_instance_method.rb +16 -11
  60. data/lib/mocha/api.rb +120 -106
  61. data/lib/mocha/argument_iterator.rb +6 -6
  62. data/lib/mocha/backtrace_filter.rb +1 -1
  63. data/lib/mocha/cardinality.rb +21 -21
  64. data/lib/mocha/central.rb +8 -8
  65. data/lib/mocha/change_state_side_effect.rb +5 -5
  66. data/lib/mocha/class_method.rb +14 -19
  67. data/lib/mocha/configuration.rb +47 -37
  68. data/lib/mocha/deprecation.rb +8 -8
  69. data/lib/mocha/exception_raiser.rb +7 -7
  70. data/lib/mocha/expectation.rb +173 -77
  71. data/lib/mocha/expectation_error.rb +2 -2
  72. data/lib/mocha/expectation_list.rb +11 -11
  73. data/lib/mocha/in_state_ordering_constraint.rb +5 -5
  74. data/lib/mocha/inspect.rb +8 -8
  75. data/lib/mocha/instance_method.rb +1 -17
  76. data/lib/mocha/integration.rb +9 -9
  77. data/lib/mocha/integration/mini_test/assertion_counter.rb +9 -9
  78. data/lib/mocha/integration/mini_test/exception_translation.rb +6 -6
  79. data/lib/mocha/integration/mini_test/version_13.rb +6 -6
  80. data/lib/mocha/integration/mini_test/version_140.rb +6 -6
  81. data/lib/mocha/integration/mini_test/version_141.rb +6 -6
  82. data/lib/mocha/integration/mini_test/version_142_to_172.rb +7 -7
  83. data/lib/mocha/integration/mini_test/version_200.rb +7 -7
  84. data/lib/mocha/integration/test_unit/assertion_counter.rb +10 -10
  85. data/lib/mocha/integration/test_unit/gem_version_200.rb +6 -6
  86. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +6 -6
  87. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +6 -6
  88. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +6 -6
  89. data/lib/mocha/is_a.rb +1 -1
  90. data/lib/mocha/logger.rb +6 -6
  91. data/lib/mocha/method_matcher.rb +7 -7
  92. data/lib/mocha/mock.rb +85 -48
  93. data/lib/mocha/mockery.rb +47 -33
  94. data/lib/mocha/module_method.rb +2 -2
  95. data/lib/mocha/multiple_yields.rb +9 -9
  96. data/lib/mocha/names.rb +18 -18
  97. data/lib/mocha/no_yields.rb +7 -7
  98. data/lib/mocha/object.rb +104 -75
  99. data/lib/mocha/parameter_matchers.rb +3 -3
  100. data/lib/mocha/parameter_matchers/all_of.rb +22 -12
  101. data/lib/mocha/parameter_matchers/any_of.rb +23 -12
  102. data/lib/mocha/parameter_matchers/any_parameters.rb +15 -8
  103. data/lib/mocha/parameter_matchers/anything.rb +20 -11
  104. data/lib/mocha/parameter_matchers/base.rb +35 -27
  105. data/lib/mocha/parameter_matchers/equals.rb +23 -12
  106. data/lib/mocha/parameter_matchers/has_entries.rb +22 -12
  107. data/lib/mocha/parameter_matchers/has_entry.rb +31 -13
  108. data/lib/mocha/parameter_matchers/has_key.rb +21 -11
  109. data/lib/mocha/parameter_matchers/has_value.rb +21 -11
  110. data/lib/mocha/parameter_matchers/includes.rb +15 -5
  111. data/lib/mocha/parameter_matchers/instance_of.rb +23 -12
  112. data/lib/mocha/parameter_matchers/is_a.rb +23 -12
  113. data/lib/mocha/parameter_matchers/kind_of.rb +23 -12
  114. data/lib/mocha/parameter_matchers/not.rb +22 -12
  115. data/lib/mocha/parameter_matchers/object.rb +5 -3
  116. data/lib/mocha/parameter_matchers/optionally.rb +24 -12
  117. data/lib/mocha/parameter_matchers/query_string.rb +14 -3
  118. data/lib/mocha/parameter_matchers/regexp_matches.rb +21 -11
  119. data/lib/mocha/parameter_matchers/responds_with.rb +17 -6
  120. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +16 -6
  121. data/lib/mocha/parameters_matcher.rb +8 -8
  122. data/lib/mocha/pretty_parameters.rb +7 -7
  123. data/lib/mocha/return_values.rb +11 -11
  124. data/lib/mocha/sequence.rb +23 -14
  125. data/lib/mocha/single_return_value.rb +7 -7
  126. data/lib/mocha/single_yield.rb +9 -9
  127. data/lib/mocha/standalone.rb +1 -1
  128. data/lib/mocha/state_machine.rb +61 -46
  129. data/lib/mocha/stubbing_error.rb +8 -5
  130. data/lib/mocha/thrower.rb +2 -2
  131. data/lib/mocha/unexpected_invocation.rb +9 -6
  132. data/lib/mocha/version.rb +1 -1
  133. data/lib/mocha/yield_parameters.rb +10 -10
  134. data/lib/mocha_standalone.rb +1 -1
  135. data/mocha.gemspec +4 -7
  136. data/test/acceptance/acceptance_test_helper.rb +10 -10
  137. data/test/acceptance/api_test.rb +20 -20
  138. data/test/acceptance/bug_18914_test.rb +12 -12
  139. data/test/acceptance/bug_21465_test.rb +6 -6
  140. data/test/acceptance/bug_21563_test.rb +5 -5
  141. data/test/acceptance/exception_rescue_test.rb +1 -1
  142. data/test/acceptance/expected_invocation_count_test.rb +17 -17
  143. data/test/acceptance/failure_messages_test.rb +13 -13
  144. data/test/acceptance/minitest_test.rb +39 -39
  145. data/test/acceptance/mocha_example_test.rb +26 -26
  146. data/test/acceptance/mocha_test_result_test.rb +13 -13
  147. data/test/acceptance/mock_test.rb +5 -5
  148. data/test/acceptance/mock_with_initializer_block_test.rb +5 -5
  149. data/test/acceptance/mocked_methods_dispatch_test.rb +4 -4
  150. data/test/acceptance/multiple_expectations_failure_message_test.rb +2 -2
  151. data/test/acceptance/optional_parameters_test.rb +5 -5
  152. data/test/acceptance/parameter_matcher_test.rb +18 -18
  153. data/test/acceptance/partial_mocks_test.rb +9 -9
  154. data/test/acceptance/raise_exception_test.rb +1 -1
  155. data/test/acceptance/return_value_test.rb +5 -5
  156. data/test/acceptance/sequence_test.rb +29 -29
  157. data/test/acceptance/states_test.rb +17 -17
  158. data/test/acceptance/stub_any_instance_method_test.rb +13 -13
  159. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +7 -7
  160. data/test/acceptance/stub_everything_test.rb +5 -5
  161. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +1 -1
  162. data/test/acceptance/stub_module_method_test.rb +17 -17
  163. data/test/acceptance/stub_test.rb +5 -5
  164. data/test/acceptance/stubba_example_test.rb +24 -24
  165. data/test/acceptance/stubba_test_result_test.rb +11 -11
  166. data/test/acceptance/stubbing_error_backtrace_test.rb +6 -6
  167. data/test/acceptance/stubbing_frozen_object_test.rb +88 -0
  168. data/test/acceptance/stubbing_method_unnecessarily_test.rb +9 -9
  169. data/test/acceptance/stubbing_nil_test.rb +59 -0
  170. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +13 -13
  171. data/test/acceptance/stubbing_non_existent_class_method_test.rb +15 -15
  172. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +14 -14
  173. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +13 -13
  174. data/test/acceptance/stubbing_non_public_class_method_test.rb +12 -12
  175. data/test/acceptance/stubbing_non_public_instance_method_test.rb +12 -12
  176. data/test/acceptance/stubbing_on_non_mock_object_test.rb +9 -9
  177. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +35 -0
  178. data/test/acceptance/throw_test.rb +1 -1
  179. data/test/deprecation_disabler.rb +1 -1
  180. data/test/execution_point.rb +7 -7
  181. data/test/method_definer.rb +1 -1
  182. data/test/mini_test_result.rb +21 -21
  183. data/test/simple_counter.rb +5 -5
  184. data/test/test_helper.rb +1 -1
  185. data/test/test_runner.rb +22 -24
  186. data/test/test_unit_result.rb +20 -0
  187. data/test/unit/any_instance_method_test.rb +28 -32
  188. data/test/unit/array_inspect_test.rb +3 -3
  189. data/test/unit/backtrace_filter_test.rb +3 -3
  190. data/test/unit/cardinality_test.rb +12 -12
  191. data/test/unit/central_test.rb +18 -18
  192. data/test/unit/change_state_side_effect_test.rb +12 -12
  193. data/test/unit/class_method_test.rb +33 -91
  194. data/test/unit/date_time_inspect_test.rb +4 -4
  195. data/test/unit/exception_raiser_test.rb +5 -5
  196. data/test/unit/expectation_list_test.rb +7 -7
  197. data/test/unit/expectation_test.rb +66 -66
  198. data/test/unit/hash_inspect_test.rb +4 -4
  199. data/test/unit/in_state_ordering_constraint_test.rb +13 -13
  200. data/test/unit/method_matcher_test.rb +3 -3
  201. data/test/unit/mock_test.rb +40 -40
  202. data/test/unit/mockery_test.rb +25 -25
  203. data/test/unit/multiple_yields_test.rb +2 -2
  204. data/test/unit/no_yields_test.rb +2 -2
  205. data/test/unit/object_inspect_test.rb +4 -4
  206. data/test/unit/object_test.rb +15 -15
  207. data/test/unit/parameter_matchers/all_of_test.rb +6 -6
  208. data/test/unit/parameter_matchers/any_of_test.rb +6 -6
  209. data/test/unit/parameter_matchers/anything_test.rb +5 -5
  210. data/test/unit/parameter_matchers/has_entries_test.rb +10 -10
  211. data/test/unit/parameter_matchers/has_entry_test.rb +13 -13
  212. data/test/unit/parameter_matchers/has_key_test.rb +11 -11
  213. data/test/unit/parameter_matchers/has_value_test.rb +12 -12
  214. data/test/unit/parameter_matchers/includes_test.rb +4 -4
  215. data/test/unit/parameter_matchers/not_test.rb +6 -6
  216. data/test/unit/parameter_matchers/regexp_matches_test.rb +9 -9
  217. data/test/unit/parameter_matchers/responds_with_test.rb +6 -6
  218. data/test/unit/parameter_matchers/stub_matcher.rb +4 -4
  219. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +6 -6
  220. data/test/unit/parameters_matcher_test.rb +16 -16
  221. data/test/unit/return_values_test.rb +5 -5
  222. data/test/unit/sequence_test.rb +10 -10
  223. data/test/unit/single_return_value_test.rb +3 -3
  224. data/test/unit/single_yield_test.rb +2 -2
  225. data/test/unit/state_machine_test.rb +19 -19
  226. data/test/unit/string_inspect_test.rb +2 -2
  227. data/test/unit/thrower_test.rb +1 -1
  228. data/test/unit/yield_parameters_test.rb +11 -11
  229. metadata +113 -101
@@ -0,0 +1,86 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: MIT-LICENSE
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: MIT-LICENSE</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'>
58
+ <p>Copyright © 2006 Revieworld Ltd.</p>
59
+
60
+ <p>Permission is hereby granted, free of charge, to any person obtaining a
61
+ copy of this software and associated documentation files (the “Software”),
62
+ to deal in the Software without restriction, including without limitation
63
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
64
+ and/or sell copies of the Software, and to permit persons to whom the
65
+ Software is furnished to do so, subject to the following conditions:</p>
66
+
67
+ <p>The above copyright notice and this permission notice shall be included in
68
+ all copies or substantial portions of the Software.</p>
69
+
70
+ <p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
73
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
75
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
76
+ DEALINGS IN THE SOFTWARE.</p>
77
+ </div></div>
78
+
79
+ <div id="footer">
80
+ Generated on Thu Apr 19 10:54:34 2012 by
81
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
82
+ 0.7.5 (ruby-1.9.3).
83
+ </div>
84
+
85
+ </body>
86
+ </html>
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: README</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'>
58
+ <h1>Mocha <a href="http://travis-ci.org/floehopper/mocha"><img src="https://secure.travis-ci.org/floehopper/mocha.png" /></a></h1>
59
+
60
+ <p>Mocha is a library for mocking and stubbing using a syntax like that of <a
61
+ href="http://www.jmock.org">JMock</a>.</p>
62
+
63
+ <p>It can be used with many testing frameworks e.g. <a
64
+ href="http://www.ruby-doc.org/core/classes/Test/Unit.html">Test::Unit</a>,
65
+ <a href="http://rspec.info/">RSpec</a>, <a
66
+ href="http://chneukirchen.org/repos/testspec/README">test/spec</a>, <a
67
+ href="http://expectations.rubyforge.org/">expectations</a>, <a
68
+ href="http://dust.rubyforge.org/">Dust</a>, <a
69
+ href="http://rubyforge.org/projects/bfts">MiniTest</a> and even <a
70
+ href="http://jtestr.codehaus.org/">JtestR</a>.</p>
71
+
72
+ <p>Mocha provides a unified, simple and readable syntax for both traditional
73
+ mocking and partial mocking.</p>
74
+
75
+ <p>Mocha was harvested from projects at <a
76
+ href="http://www.reevoo.com/">Reevoo</a> by me (<a
77
+ href="http://jamesmead.org/">James</a>) and my (then) colleagues <a
78
+ href="http://www.techbelly.com/">Ben</a>, <a
79
+ href="http://chrisroos.co.uk/">Chris</a> and <a
80
+ href="http://po-ru.com/">Paul</a>.</p>
81
+
82
+ <h2>Installation</h2>
83
+
84
+ <p>Install the latest version of the gem with the following command…</p>
85
+
86
+ <pre class="code ruby"><code>$ gem install mocha</code></pre>
87
+
88
+ <p>Note that if you are intending to use Mocha with Test::Unit or MiniTest,
89
+ you should only load Mocha <b>after</b> loading the relevant test library…</p>
90
+
91
+ <pre class="code ruby"><code><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>&quot;</span></span>
92
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span></code></pre>
93
+
94
+ <p>If you’re using Bundler, ensure the correct load order by not
95
+ auto-requiring Mocha in the Gemfile and then later load it once you know
96
+ the test library has been loaded…</p>
97
+
98
+ <pre class="code ruby"><code><span class='comment'># Gemfile
99
+ </span><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:require</span> <span class='op'>=&gt;</span> <span class='kw'>false</span>
100
+
101
+ <span class='comment'># Elsewhere after Bundler has loaded gems
102
+ </span><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>&quot;</span></span>
103
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span></code></pre>
104
+
105
+ <p>Note that versions 0.10.2 &amp; 0.10.3 included a bug. Please do not use
106
+ these versions.</p>
107
+
108
+ <p>Or install the <a href="http://www.rubyonrails.org/">Rails</a> plugin…</p>
109
+
110
+ <pre class="code ruby"><code>$ script/plugin install git://github.com/floehopper/mocha.git</code></pre>
111
+
112
+ <p>Note that versions 0.9.6 &amp; 0.9.7 of the Rails plugin were broken. As of
113
+ version 0.9.8, you need to explicitly load Mocha after the test framework
114
+ e.g. by adding “require ‘mocha’” at the bottom of test/test_helper.rb.</p>
115
+
116
+ <h2>Examples</h2>
117
+ <ul><li>
118
+ <p>Quick Start - <a href="file.misc.html" title="Usage Examples">Usage Examples</a></p>
119
+ </li><li>
120
+ <p>Traditional mocking - <a href="file.mocha.html" title="Star Trek Example">Star Trek Example</a></p>
121
+ </li><li>
122
+ <p>Setting expectations on real classes - <a href="file.stubba.html" title="Order Example">Order Example</a></p>
123
+ </li><li>
124
+ <p>More examples on <a href="http://jamesmead.org/blog/">James Mead’s Blog</a></p>
125
+ </li><li>
126
+ <p><a href="http://groups.google.com/group/mocha-developer">Mailing List
127
+ Archives</a></p>
128
+ </li></ul>
129
+
130
+ <h2>Links</h2>
131
+ <ul><li>
132
+ <p><a href="http://github.com/floehopper/mocha">Source code</a></p>
133
+ </li><li>
134
+ <p><a href="http://github.com/floehopper/mocha/issues">Bug reports</a></p>
135
+ </li></ul>
136
+
137
+ <h2>License</h2>
138
+
139
+ <p>Copyright Revieworld Ltd. 2006</p>
140
+
141
+ <p>You may use, copy and redistribute this library under the same terms as <a
142
+ href="http://www.ruby-lang.org/en/LICENSE.txt">Ruby itself</a> or under the
143
+ <a href="file.MIT-LICENSE.html" title="MIT license">MIT license</a>.</p>
144
+ </div></div>
145
+
146
+ <div id="footer">
147
+ Generated on Thu Apr 19 10:54:33 2012 by
148
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
+ 0.7.5 (ruby-1.9.3).
150
+ </div>
151
+
152
+ </body>
153
+ </html>
@@ -0,0 +1,933 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: RELEASE
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: RELEASE</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'>
58
+ <h1>0.11.0 ()</h1>
59
+ <ul><li>
60
+ <p>Store original method when stubbing rather than using alias_method. This
61
+ fixes #41, #47, #74 and all tests now pass on both Ruby 1.8.7 and 1.9.3.</p>
62
+ </li><li>
63
+ <p>Attempting to stub a method on a frozen object should fail fast. See #68.</p>
64
+ </li><li>
65
+ <p>Prevent stubbing a method on nil by default. See #68.</p>
66
+ </li><li>
67
+ <p>Generate documentation using YARD instead of Rdoc - removes dependency on
68
+ Coderay.</p>
69
+ </li><li>
70
+ <p>Publish documentation on Github pages instead of Rubyforge - uses rake task
71
+ written by @tomafro.</p>
72
+ </li><li>
73
+ <p>Remove agiledox which has outlived it’s usefulness.</p>
74
+ </li><li>
75
+ <p>Removed trailing whitespace throughout codebase.</p>
76
+ </li><li>
77
+ <p>Add documentation for Mock#unstub.</p>
78
+ </li><li>
79
+ <p>Improve documentation for ObjectMethods.</p>
80
+ </li><li>
81
+ <p>Provide a way to run multiple tests within a single acceptance test method.</p>
82
+ </li></ul>
83
+
84
+ <h1>0.10.5 (a5a64cf9755b21d4a30e446232654d1c0fc6f151)</h1>
85
+ <ul><li>
86
+ <p>Fix for issue #66 (hopefully without regressing on issue #63) - Mocha::Mock
87
+ has Mocha::Mockery as a dependency. Stop trying to pretend otherwise.
88
+ Thanks to @kennyj for reporting.</p>
89
+ </li><li>
90
+ <p>Fix a bunch of warnings in Ruby 1.9. There are still the 6 test failures
91
+ mentioned in issue #41 which I suspect are due to the introspection gem not
92
+ being Ruby 1.9-compatible.</p>
93
+ </li><li>
94
+ <p>Add links to README for source code &amp; issue tracker.</p>
95
+ </li><li>
96
+ <p>Fix for issue #67 - Make the travis-ci badge visible in the README. Thanks
97
+ to Diego Plentz for pull request.</p>
98
+ </li><li>
99
+ <p>Fix for issue #70 - Rename Mock#expectations to Mock#__expectations__ to
100
+ avoid conflicts. Thanks to Jeremy Stephens for pull request.</p>
101
+ </li></ul>
102
+
103
+ <h1>0.10.4 (babdd656c361ac65f25948104adf612e59174a5e)</h1>
104
+ <ul><li>
105
+ <p>Fix for issue #65 - expectations not being verified in subsequent tests.</p>
106
+ </li><li>
107
+ <p>Fix for issue #63 - require Mocha::Mockery at Mocha::Mock class load time
108
+ and not on invocation of Mock#method_missing.</p>
109
+ </li><li>
110
+ <p>Fix for issue #45 - raise ArgumentError if
111
+ Mocha::ParameterMatchers#has_entry is given</p>
112
+ </li></ul>
113
+
114
+ <p>Hash with wrong number of entries.</p>
115
+ <ul><li>
116
+ <p>Make global variable name more obscure to avoid clashes with other
117
+ libraries.</p>
118
+ </li><li>
119
+ <p>Move travis-ci-related gemfiles into their own directory.</p>
120
+ </li></ul>
121
+
122
+ <h1>0.10.3 (e7f88af8e7c3396bc85fe9f9cb9e5f5fef04bea2)</h1>
123
+ <ul><li>
124
+ <p>Fix for issue #57. Gem::Requirement#=~ was only added in rubygems v1.8.0,
125
+ but Object#=~ means the result of various monkey-patching checks is always
126
+ false/nil for earlier versions of rubygems. However, the method it aliases
127
+ #satisfied_by? has existed since Gem::Dependency was extracted from
128
+ Gem::Version in rubygems v0.9.4.4, so it’s much safer to use that. Thanks
129
+ to fguillen for reporting and helping with diagnosis.</p>
130
+ </li></ul>
131
+
132
+ <h1>0.10.2 (e05d9a555f1cf97c5961900dab0d884e9753257b)</h1>
133
+ <ul><li>
134
+ <p>Merge pull request #53. Unstubbing a method should not remove expectations
135
+ for other stubbed methods. Fixes #52. Thanks to saikat.</p>
136
+ </li></ul>
137
+
138
+ <h1>0.10.1 (f631a4ba22c6ed4929c52b0520311a9a84034a20)</h1>
139
+ <ul><li>
140
+ <p>Merge pull request #51. Use Gem::Requirement &amp; Gem::Version for version
141
+ comparison. Fixes issue #50. Thanks to meineerde.</p>
142
+ </li><li>
143
+ <p>Fixed typo in rdoc for Mocha::ObjectMethods.</p>
144
+ </li><li>
145
+ <p>Improve README as suggested in issue #46. Explain that Mocha must be loaded
146
+ after test libraries and how to achieve this using Bundler.</p>
147
+ </li><li>
148
+ <p>Merge pull request #43 - nobody expects the spanish inquisition! Thanks to
149
+ cairo140.</p>
150
+ </li><li>
151
+ <p>Fix for issue #39 - improve documentation for Expectation#multiple_yields.</p>
152
+ </li><li>
153
+ <p>Fix for issue #38 where a subtle change in test-unit v2.3.0 had been missed
154
+ - only visible in verbose mode.</p>
155
+ </li><li>
156
+ <p>Support for MiniTest up to v2.6.2 has been verified.</p>
157
+ </li><li>
158
+ <p>Add explicit development dependency on coderay for generating
159
+ syntax-highlighted code examples.</p>
160
+ </li></ul>
161
+
162
+ <h1>0.10.0 (68a4a59e1af74baf3929af418f73f5627bba548d)</h1>
163
+ <ul><li>
164
+ <p>Add Expectation#throws to allow a stubbed method to use Kernel#throw.</p>
165
+ </li><li>
166
+ <p>Updates for versions of Test::Unit up to and including v2.3.3 (including
167
+ patch by Jens Fahnenbruck).</p>
168
+ </li><li>
169
+ <p>Updates for versions of MiniTest up to and including v2.5.1.</p>
170
+ </li><li>
171
+ <p>Since the singleton method added by Mocha masks the underlying instance
172
+ method, there’s no need to move it out the way and then back again. This
173
+ fixes Github issue #20, because the original method is left unchanged - <a
174
+ href="https://github.com/floehopper/mocha/issues/20">github.com/floehopper/mocha/issues/20</a>
175
+ (thanks to Nick Lewis).</p>
176
+ </li><li>
177
+ <p>Handle stubbing of a singleton method, leaving the original method
178
+ unchanged after the test.</p>
179
+ </li><li>
180
+ <p>When stubbing an instance method that was originally defined as a singleton
181
+ method, the original method should still exist after the test.</p>
182
+ </li><li>
183
+ <p>Fixed mis-print in Mocha::ObjectMethods#unstub documentation (patch by Gleb
184
+ Pomykalov).</p>
185
+ </li><li>
186
+ <p>Improved test coverage around stubbing of methods defined in different ways
187
+ - this makes use of the newly extracted introspection gem (although this
188
+ means some tests are now failing in Ruby v1.9.2).</p>
189
+ </li><li>
190
+ <p>Added configuration for Travis continuous integration.</p>
191
+ </li><li>
192
+ <p>Make the gemspec the canonical reference and stop generating it from the
193
+ Rakefile.</p>
194
+ </li><li>
195
+ <p>Use the built-in Bundler rake tasks for packaging the gem.</p>
196
+ </li><li>
197
+ <p>Use the “release” rake task provided by Bundler instead of using the
198
+ Rake::XForge::Release functionality.</p>
199
+ </li><li>
200
+ <p>Extract Object#__metaclass__ into a new metaclass gem.</p>
201
+ </li><li>
202
+ <p>Run rake tasks without `bundle exec`.</p>
203
+ </li><li>
204
+ <p>Avoid deprecation warning for rdoc rake task.</p>
205
+ </li><li>
206
+ <p>Remove the `use_test_unit_gem` MOCHA_OPTION which hasn’t worked since we
207
+ switched to bundler - we can now run the tests specifying a different
208
+ Gemfile instead.</p>
209
+ </li><li>
210
+ <p>Use multiple Gemfiles seems to run Travis CI builds against multiple
211
+ version of test-unit &amp; minitest.</p>
212
+ </li></ul>
213
+
214
+ <h1>0.9.12 (8bb523e8467626c23b271eb529c33fb118e368fe)</h1>
215
+ <ul><li>
216
+ <p>Make Mocha’s tests pass under Ruby 1.9.2 i.e. using MiniTest. One of the
217
+ main issues was that we were not parsing stacktraces on MiniTest errors
218
+ comprehensively enough.</p>
219
+ </li><li>
220
+ <p>Avoid ‘circular require considered harmful’ warning when running Mocha’s
221
+ tests in Ruby 1.9.2</p>
222
+ </li><li>
223
+ <p>Make performance tests work on Ruby 1.9.2 i.e. using MiniTest.</p>
224
+ </li><li>
225
+ <p>Declare rake as a <b>development</b> dependency with newer versions of
226
+ Rubygems since it’s only needed to carry out developer-related tasks.</p>
227
+ </li></ul>
228
+
229
+ <h1>0.9.11 (1613ed2267fef5927ea06adfdbcf512b89eadaad)</h1>
230
+ <ul><li>
231
+ <p>Added explicit support for minitest v1.5.0 to v2.0.2.</p>
232
+ </li><li>
233
+ <p>Make testable by rubygems-test.</p>
234
+ </li><li>
235
+ <p>Update links to my blog and make other links consistent.</p>
236
+ </li><li>
237
+ <p>Added a URI parameter matcher that ignores the order of query parameters so
238
+ that tests can be independent of undefined hash ordering (patch by Paul
239
+ Battley).</p>
240
+ </li><li>
241
+ <p>Include unexpected invocation in failure message and change the language
242
+ slightly to make the failure message less confusing. See <a
243
+ href="http://floehopper.lighthouseapp.com/projects/22289/tickets/52">floehopper.lighthouseapp.com/projects/22289/tickets/52</a>.</p>
244
+ </li><li>
245
+ <p>No need to create regular expression every time the
246
+ BacktraceFilter#filtered method is called. See <a
247
+ href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/66">floehopper.lighthouseapp.com/projects/22289-mocha/tickets/66</a>.</p>
248
+ </li></ul>
249
+
250
+ <h1>0.9.10 (31182ea8b38b79aa50702aa839f6a29ebcf7d684)</h1>
251
+ <ul><li>
252
+ <p>Added Mocha::ObjectMethods#unstub method - <a
253
+ href="https://github.com/floehopper/mocha/issues#issue/6">github.com/floehopper/mocha/issues#issue/6</a></p>
254
+ </li><li>
255
+ <p>Inherit Mocha::ExpectationError from Exception instead of StandardError to
256
+ reduce the chances of a test passing by accident - thanks to James Sanders
257
+ (jsanders) - <a
258
+ href="https://github.com/floehopper/mocha/issues#issue/15">github.com/floehopper/mocha/issues#issue/15</a></p>
259
+ </li><li>
260
+ <p>Fixed bug - GitHub README page to link correctly to code examples - <a
261
+ href="https://github.com/floehopper/mocha/issues/closed#issue/11">github.com/floehopper/mocha/issues/closed#issue/11</a></p>
262
+ </li><li>
263
+ <p>Fixed bug - PASSTHROUGH_EXCEPTIONS are defined on MiniTest::Unit::TestCase
264
+ not in Mocha - thanks to Brian Troutwine (blt) - <a
265
+ href="https://github.com/floehopper/mocha/issues/closed#issue/14">github.com/floehopper/mocha/issues/closed#issue/14</a></p>
266
+ </li></ul>
267
+
268
+ <h1>0.9.9 (ee3a79db4d52c3339e8acf07505e01236a2b4810)</h1>
269
+ <ul><li>
270
+ <p>Avoid loading bits of the test-unit gem by accident. This is an attempt at
271
+ a fix for the problem that James Adam reported [1]. By using ‘load’ instead
272
+ of ‘require’ to detect the version of Test::Unit, we can avoid rubygems
273
+ trying to load bits of the test-unit gem when it’s not wanted. [1] <a
274
+ href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50#ticket-50-13">floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50#ticket-50-13</a></p>
275
+ </li><li>
276
+ <p>Fix exception when running rake without test-unit gem. When test-unit gem
277
+ &gt;=v2.0.0 was installed but the “use_test_unit_gem” MOCHA_OPTIONS was not
278
+ specified, a “comparison of Fixnum with Hash failed” exception was being
279
+ raised when running the performance tests. This was because bits of the
280
+ test-unit gem were being loaded accidentally and a Hash was being
281
+ incorrectly supplied to the TestRunner.run method.</p>
282
+ </li><li>
283
+ <p>Explicitly require rubygems for running tests via rake using test-unit gem.</p>
284
+ </li><li>
285
+ <p>Handle newer versions of test-unit gem (v2.0.2 to v2.0.9)</p>
286
+ </li><li>
287
+ <p>Handle newer versions of minitest gem (v1.4.0 to v1.6.0)</p>
288
+ </li><li>
289
+ <p>Added warnings about monkey-patching test-unit and minitest to aid
290
+ debugging. These are enabled by including “debug” in the MOCHA_OPTIONS
291
+ environment variable. This is now a comma-separated list, so that we can
292
+ specify multiple options e.g. MOCHA_OPTIONS=debug,use_test_unit_gem</p>
293
+ </li><li>
294
+ <p>Eloy Duran (alloy) made the unit tests run on 1.9.2dev r25249.</p>
295
+ </li><li>
296
+ <p>Eloy Duran (alloy) also improved some MiniTest TestResult code I’d written
297
+ and got the acceptance tests running on Ruby 1.9 HEAD. There are still 4
298
+ failures because for some reason the backtrace line numbers are off by one.
299
+ And the minitest_test test case does not run when the whole suite is run
300
+ with MiniTest. These issues still need investigation.</p>
301
+ </li><li>
302
+ <p>Fixed some acceptance tests to run in Ruby 1.9.2 - it’s no longer possible
303
+ to subvert the protection of a method by calling it via Object#send.</p>
304
+ </li><li>
305
+ <p>Fixed “test:performance” rake task so it runs in Ruby 1.9.2.</p>
306
+ </li><li>
307
+ <p>Fix test incorrectly failing under Rubinius 1.0. This test imposed too many
308
+ constraints. It appears that Object#inspect legitimately calls
309
+ Object#object_id in Rubinius. But we’re only interested in what ‘id’
310
+ methods Mocha::ObjectMethods#mocha_inspect calls. By stubbing
311
+ Object#inspect we can relax the constraints imposed by the test.</p>
312
+ </li><li>
313
+ <p>Luke Redpath (lukeredpath) added new shorthand “any” and “all” composite
314
+ parameter matchers using “&amp;” and “|”. This provides an alternative
315
+ syntax for expecting any or all matchers to pass, e.g.
316
+ foo.expects(:bar).with(equals(1) | equals(2)).</p>
317
+ </li><li>
318
+ <p>Improved documentation for Expectation#raises. A number of people have
319
+ suggested an extension to the API to cope with custom exceptions that have
320
+ extra constructor parameters. However, since the arguments supplied to
321
+ Expectation#raises are just passed on to Kernel#raise, it’s possible to
322
+ pass in an instance of an exception. Thus no change to the API is required,
323
+ but it does seem worthwhile pointing this out in the docs.</p>
324
+ </li><li>
325
+ <p>Corrected RDoc example for Expectation#never thanks to Red David
326
+ (reddavis).</p>
327
+ </li><li>
328
+ <p>Improved RDoc including a change suggested by Rohit Arondekar (rohit).</p>
329
+ </li><li>
330
+ <p>Updated gemspec as requested by Sam Woodard (shwoodard).</p>
331
+ </li></ul>
332
+
333
+ <h1>0.9.8 (645024765b2d92018efc511652e1174163844e39)</h1>
334
+ <ul><li>
335
+ <p>Fixed bug “NameError raised when using Mocha as a Rails plug-in” - <a
336
+ href="http://floehopper.lighthouseapp.com/projects/22289/tickets/53">floehopper.lighthouseapp.com/projects/22289/tickets/53</a>.
337
+ Since 0.9.6 the Rails plugin has been broken. See bug report for details.
338
+ You will need to explicitly load Mocha <b>after</b> the test framework has
339
+ been loaded, e.g. by adding “require ‘mocha’” at the bottom of
340
+ test/test_helper.rb.</p>
341
+ </li><li>
342
+ <p>Make Mocha::ParameterMatchers#regexp_matches, #includes, #has_value,
343
+ #has_key more robust. Thanks to Sander Hartlage.</p>
344
+ </li><li>
345
+ <p>Allow passing a block to Mocha::Configuration methods to only change
346
+ configuration for the duration of the block. Thanks to Dan Manges.</p>
347
+ </li><li>
348
+ <p>Fixed bug “doc generation fails in 0.9.7 gem” - <a
349
+ href="http://floehopper.lighthouseapp.com/projects/22289/tickets/51">floehopper.lighthouseapp.com/projects/22289/tickets/51</a>.</p>
350
+ </li><li>
351
+ <p>Remove rdoc template incorporating google analytics from source control.
352
+ The file just needs to exist locally and be ignored by source control. This
353
+ should stop the warning showing up on e.g. RunCodeRun build results.</p>
354
+ </li></ul>
355
+
356
+ <h1>0.9.7 (80d816f250dc13aaf856f3f9cbd97ebe9c371839)</h1>
357
+ <ul><li>
358
+ <p>Although I had provided a deprecation warning for people using
359
+ Mocha::Standalone, I had assumed people wouldn’t be explicitly loading the
360
+ mocha/standalone.rb file. It turns out this assumption was incorrect at
361
+ least in the case of Rspec. This is now fixed.</p>
362
+ </li></ul>
363
+
364
+ <h1>0.9.6 (57f8f77d715b7f1d9efee2e1a9438f7905c0006b)</h1>
365
+ <ul><li>
366
+ <p>Version 2.0.1 of the test-unit gem introduced a private ‘run_test’ method
367
+ on TestCase which clashed with the public TestRunner#run_test method. So
368
+ this latter method has been renamed to ‘run_as_test’.</p>
369
+ </li><li>
370
+ <p>Stop requiring rubygems - this should be an environmental choice for the
371
+ user. <a href="http://gist.github.com/54177">gist.github.com/54177</a> -
372
+ describes why requiring rubygems in your library code is a bad idea.</p>
373
+ </li><li>
374
+ <p>It seems like overkill to vendorize coderay and meta_project when they’re
375
+ only needed to generate the examples for documentation and for publishing
376
+ files on RubyForge. So I’m removing them and installing them locally as
377
+ gems when I need them.</p>
378
+ </li><li>
379
+ <p>Added support for ‘test-unit’ gem (version &gt;= 2.0). Note that as with
380
+ other versions of Test::Unit I’m completely replacing the TestCase#run
381
+ method. Unfortunately in version 2.0.0 this method differs slightly from
382
+ the same method in version 2.0.1 &amp; 2.0.2, so we have to provide
383
+ different implementations to ensure that the internal working of Test::Unit
384
+ are not compromised by Mocha. Note also that unless the ‘test-unit’ gem is
385
+ loaded, requiring ‘test/unit’ leads to a mixture of stdlib and gem classes
386
+ being loaded causing errors. To avoid a dependency on rubygems, the gem is
387
+ loaded only if MOCHA_OPTIONS is set to ‘use_test_unit_gem’ - this option is
388
+ only intended for use in running Mocha’s own tests. It might be worthwhile
389
+ to create a shim gem like minitest_tu_shim to allow the test-unit gem to
390
+ completely replace the stdlib, but that’s a job for another day. The
391
+ changes in the Rakefile are to make the default task run with the
392
+ ‘test-unit’ gem (version &gt;= 2.0).</p>
393
+ </li><li>
394
+ <p>Renamed Mocha::Standalone to Mocha::API to better reflect its purpose.
395
+ Added a deprecation warning for those who are referencing
396
+ Mocha::Standalone.</p>
397
+ </li><li>
398
+ <p>Fix exception raised by HasEntry#matches? if first param is not a Hash
399
+ (thanks to Taylor Barstow).</p>
400
+ </li><li>
401
+ <p>Ken Collins reported [1] that Mocha is always loading MiniTest if it is
402
+ available and loading it causes some Rails/ActionPack tests to break. I’ve
403
+ removed the loading of MiniTest, but this now means the user has to ensure
404
+ that if they want to use MiniTest in conjunction with Mocha, he must load
405
+ MiniTest before loading Mocha. [1] <a
406
+ href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2060">rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2060</a></p>
407
+ </li><li>
408
+ <p>Implemented Bacon integration (thanks to Ubiratan Pires Alberton), but this
409
+ was then removed after deciding only to maintain integration with
410
+ Test::Unit and MiniTest which are both Ruby standard libraries. See mailing
411
+ list for details.</p>
412
+ </li><li>
413
+ <p>Don’t monkey-patch MiniTest if it’s already been monkey-patched by Mocha.</p>
414
+ </li><li>
415
+ <p>Fixed bug: MiniTest integration was counting ExpectationErrors as errors
416
+ not failures. <a
417
+ href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/41">floehopper.lighthouseapp.com/projects/22289-mocha/tickets/41</a>.</p>
418
+ </li><li>
419
+ <p>Fixed bug: Some Bacon tests were failing in Ruby 1.9.1. <a
420
+ href="http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/43">floehopper.lighthouseapp.com/projects/22289-mocha/tickets/43</a>.</p>
421
+ </li><li>
422
+ <p>Chad Humphries pointed out that in Ruby 1.9.1, if you are not using
423
+ Test::Unit or MiniTest, Mocha will attempt to load and monkey-patch
424
+ Test::Unit. Mocha will now only monkey-patch Test::Unit and/or MiniTest if
425
+ they have already been loaded. MiniTest tests will now run in both Ruby
426
+ 1.8.6 (with MiniTest gem) and in Ruby 1.9.1 (with MiniTest std lib). See
427
+ Ligthouse ticket - <a
428
+ href="http://floehopper.lighthouseapp.com/projects/22289/tickets/49">floehopper.lighthouseapp.com/projects/22289/tickets/49</a>.</p>
429
+ </li><li>
430
+ <p>Made Mocha compatible with minitest 1.4.0 and above (thanks to Denis
431
+ Defreyne).</p>
432
+ </li></ul>
433
+
434
+ <h1>0.9.5 (93cad010345ce5d68f31422cfc32ed9dd6de13ec)</h1>
435
+ <ul><li>
436
+ <p>Fixed Lighthouse bug #32 - stub_everything should mean mock responds to
437
+ anything.</p>
438
+ </li><li>
439
+ <p>Added Expectation#twice to improve readability. Thanks to pull request from
440
+ Celestino Gomes.</p>
441
+ </li><li>
442
+ <p>In Ruby 1.9.1, requiring ‘test/unit’ loads a thin wrapper around MiniTest
443
+ and Test::Unit::TestCase ends up inheriting from MiniTest::Unit::TestCase.
444
+ So we need to avoid including the Mocha modules more than once to avoid
445
+ nasty consequences. Thanks to Matthias Hennemeyer for help with this.</p>
446
+ </li><li>
447
+ <p>Ruby 1.9 includes rake, but not rake/contrib. For the moment I’ve moved the
448
+ sshpublisher require into the only rake task that needs it, so that I can
449
+ at least run the tests in Ruby 1.9. It looks like I will need to build a
450
+ rake/contrib gem or similar to get this working properly - <a
451
+ href="http://intertwingly.net/blog/2008/01/07/Rake-Contrib-for-1-9">intertwingly.net/blog/2008/01/07/Rake-Contrib-for-1-9</a></p>
452
+ </li></ul>
453
+
454
+ <h1>0.9.4 (8a59c6ff0f99f34b02bd99f19536a7893be2b340)</h1>
455
+ <ul><li>
456
+ <p>Added mocha.gemspec file generated with Chad Woolley’s new rake task, so
457
+ that a floehopper-mocha gem will get built on GitHub.</p>
458
+ </li><li>
459
+ <p>Add rake task to update mocha.gemspec with unique version, which will cause
460
+ gem to be auto-built on github</p>
461
+ </li><li>
462
+ <p>As Tobias Crawley correctly pointed out in feature request #23055
463
+ “stubs(with_hash) not working with existing object” [1], following the
464
+ principle of least surprise, it should be possible to call
465
+ ObjectMethods#expects &amp; ObjectMethods#stubs with a Hash of method_names
466
+ vs return_values like you can with Mock#expects &amp; Mock#stubs. I’ve also
467
+ updated &amp; improved the docs to reflect the changes. [1] <a
468
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=23055&group_id=1917&atid=7480">rubyforge.org/tracker/index.php?func=detail&aid=23055&group_id=1917&atid=7480</a></p>
469
+ </li><li>
470
+ <p>Removed deprecated gem autorequire.</p>
471
+ </li></ul>
472
+
473
+ <h1>0.9.3 (8219bb2d2881c8529c93fc21e97a11d01203c759)</h1>
474
+ <ul><li>
475
+ <p>Added support for MiniTest thanks to Jeff Smick.</p>
476
+ </li><li>
477
+ <p>Fixed a possible bug with some of the non-default Configuration options
478
+ relating to the argument to Object#respond_to?</p>
479
+ </li><li>
480
+ <p>As per Jay Fields recommendations [1] and with further impetus from a talk
481
+ at Ruby Manor, any methods added to core classes are now added by including
482
+ a module. This means that Mocha is a better citizen of the Ruby world and
483
+ it’s behaviour is more easily extended. [1] <a
484
+ href="http://blog.jayfields.com/2008/07/ruby-underuse-of-modules.html">blog.jayfields.com/2008/07/ruby-underuse-of-modules.html</a>
485
+ &amp; <a
486
+ href="http://blog.jayfields.com/2008/07/ruby-redefine-method-behavior.html">blog.jayfields.com/2008/07/ruby-redefine-method-behavior.html</a></p>
487
+ </li><li>
488
+ <p>Removed deprecated gem autorequire.</p>
489
+ </li></ul>
490
+
491
+ <h1>0.9.2 (r355)</h1>
492
+ <ul><li>
493
+ <p>Improved documentation to address [#22530] ‘Mock methods with multiple
494
+ return values not possible?’</p>
495
+ </li><li>
496
+ <p>respond_with parameter matcher was not available in tests.</p>
497
+ </li><li>
498
+ <p>Patch [#22630] Fix for a bug in running Rails tests with Ruby 1.8.7.
499
+ Array#flatten was being called which in turn was checking whether each
500
+ element responded to #to_ary. This check was using the two parameter
501
+ version of #respond_to?, but Mock was only defining a one parameter
502
+ version.</p>
503
+ </li></ul>
504
+
505
+ <h1>0.9.1 (r349)</h1>
506
+ <ul><li>
507
+ <p>Fixed bug #21465 - expects &amp; stubs should support method names as
508
+ strings (as well as symbols) or fail fast. Convert all expectation method
509
+ names to a symbol in case they were supplied as a string.</p>
510
+ </li><li>
511
+ <p>By removing Mock#unexpected_method_called we reduce the number of methods
512
+ vulnerable to the problem that surfaced in bug #21563.</p>
513
+ </li><li>
514
+ <p>Fix bug #21563 - stubbing ‘verified?’ method is unsafe. Instance method
515
+ names on the Mock class should be more obscure.</p>
516
+ </li><li>
517
+ <p>Performance improvement. StubbaExampleTest goes twice as fast on my local
518
+ machine.</p>
519
+ </li><li>
520
+ <p>Added primitive performance test to default rake task.</p>
521
+ </li><li>
522
+ <p>Fix format of case statements which don’t work in Ruby 1.9 and make others
523
+ consistent.</p>
524
+ </li><li>
525
+ <p>There is no point in running (potentially expensive) checks if
526
+ configuration is set to allow such checks to fail. This is a relatively
527
+ quick fix in response to Chris McGrath’s performance problems.</p>
528
+ </li><li>
529
+ <p>Fix for bug #21161 - ‘uninitialized constant Deprecation in stubba.rb’.</p>
530
+ </li><li>
531
+ <p>It’s more readable to talk about ‘once’ and ‘twice’ rather than ‘1 time’
532
+ and ‘2 times’.</p>
533
+ </li><li>
534
+ <p>Fix bug #20883 - never should raise when called to prevent follow up
535
+ errors. Fail fast when there are no matching invokable expectations and
536
+ handle the stub_everything case sensibly. This might not be entirely
537
+ backwards compatible, but I think the benefits outweigh the risks. The most
538
+ likely change is that a test that was already failing will now fail faster,
539
+ which doesn’t seem so awful.</p>
540
+ </li></ul>
541
+
542
+ <h1>0.9.0 (r316)</h1>
543
+ <ul><li>
544
+ <p>Configurable warnings or errors</p>
545
+ <ul><li>
546
+ <p>when a method on a non-public method is stubbed</p>
547
+ </li><li>
548
+ <p>when a method on a non-existent method is stubbed</p>
549
+ </li><li>
550
+ <p>when a method on a non-mock object is stubbed</p>
551
+ </li><li>
552
+ <p>when a method is stubbed unnecessarily (i.e. the stubbed method is not
553
+ called during the test)</p>
554
+ </li></ul>
555
+ </li><li>
556
+ <p>Improved error messages</p>
557
+ <ul><li>
558
+ <p>User-friendly list of unsatisfied expectations, satisfied expectations and
559
+ state machines.</p>
560
+ </li><li>
561
+ <p>Improved readability of cardinality description.</p>
562
+ </li><li>
563
+ <p>Display sensible failure message for any_instance expectations e.g.
564
+ “#&lt;AnyInstance:Foo&gt;.bar - expected calls: 1, actual calls: 0”</p>
565
+ </li></ul>
566
+ </li><li>
567
+ <p>Parameter matchers</p>
568
+ <ul><li>
569
+ <p>New to this release</p>
570
+ <ul><li>
571
+ <p>optionally (allows matching of optional parameters if available)</p>
572
+ </li><li>
573
+ <p>yaml_equivalent (allows matching of YAML that represents the specified
574
+ object)</p>
575
+ </li><li>
576
+ <p>responds_with (tests the quack not the duck)</p>
577
+ </li></ul>
578
+ </li><li>
579
+ <p>Nesting of parameter matchers is now supported.</p>
580
+ </li></ul>
581
+ </li><li>
582
+ <p>Optional block passed into mock initializer is evaluated in the context of
583
+ the new mock instance and can be used as a shortcut to set up expectations.</p>
584
+ </li><li>
585
+ <p>Added JMock-style sequences for constraining the order of expected
586
+ invocations. See Standalone#sequence and Expectation#in_sequence.</p>
587
+ </li><li>
588
+ <p>Added JMock-style states for constraining the order of expected
589
+ invocations. See Standalone#states, Expectation#then, Expectation#when and
590
+ StateMachine.</p>
591
+ </li><li>
592
+ <p>Compatibility with versions of Ruby</p>
593
+ <ul><li>
594
+ <p>Compatibility with Ruby v1.9. All test errors and warnings fixed.</p>
595
+ </li><li>
596
+ <p>Nasty fix so that TestCaseAdaptor works consistently with earlier versions
597
+ of Test::Unit as well as more recent versions.</p>
598
+ </li><li>
599
+ <p>Added platform to gem specification to avoid bug in rubygems 0.9.5 - see <a
600
+ href="http://www.dcmanges.com/blog/rubygems-0-9-5-platform-bug">www.dcmanges.com/blog/rubygems-0-9-5-platform-bug</a>
601
+ and <a
602
+ href="http://rubygems.org/read/chapter/20#platform">rubygems.org/read/chapter/20#platform</a>.</p>
603
+ </li><li>
604
+ <p>Make ExpectationRaiser deal with subclasses of Interrupt which seem to need
605
+ a message supplied in the raise statement in Ruby 1.8.6 (but not 1.8.4 or
606
+ 1.9). Not sure this is really Mocha’s responsibility.</p>
607
+ </li></ul>
608
+ </li><li>
609
+ <p>Added deprecation warning in stubba.rb which is no longer needed and will
610
+ be removed.</p>
611
+ </li><li>
612
+ <p>Supply positioning information to evals to improve any error messages. See
613
+ <a
614
+ href="http://ola-bini.blogspot.com/2008/01/ruby-antipattern-using-eval-without.html">ola-bini.blogspot.com/2008/01/ruby-antipattern-using-eval-without.html</a></p>
615
+ </li><li>
616
+ <p>Bug fixes</p>
617
+ <ul><li>
618
+ <p>18914 in revision 296 - <a
619
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=18914&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=18914&group_id=1917&atid=7477</a></p>
620
+ </li><li>
621
+ <p>18917 in revision 295 - <a
622
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=18917&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=18917&group_id=1917&atid=7477</a></p>
623
+ </li><li>
624
+ <p>18336 in revision 287 - <a
625
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=18336&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=18336&group_id=1917&atid=7477</a></p>
626
+ </li><li>
627
+ <p>17835 in revision 255 - <a
628
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=17835&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=17835&group_id=1917&atid=7477</a></p>
629
+ </li><li>
630
+ <p>17412 in revision 242 - <a
631
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=17412&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=17412&group_id=1917&atid=7477</a></p>
632
+ </li><li>
633
+ <p>15977 in revision 198 - <a
634
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=15977&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=15977&group_id=1917&atid=7477</a></p>
635
+ </li><li>
636
+ <p>11885 in revision 156 - <a
637
+ href="http://rubyforge.org/tracker/index.php?func=detail&aid=11885&group_id=1917&atid=7477">rubyforge.org/tracker/index.php?func=detail&aid=11885&group_id=1917&atid=7477</a></p>
638
+ </li></ul>
639
+ </li></ul>
640
+
641
+ <h1>0.5.5 (r167)</h1>
642
+ <ul><li>
643
+ <p>Renamed Matches parameter matcher to RegexpMatches for clarity.</p>
644
+ </li><li>
645
+ <p>Added noframes tag to rdoc index to assist Google.</p>
646
+ </li></ul>
647
+
648
+ <h1>0.5.4 (r166)</h1>
649
+ <ul><li>
650
+ <p>Added matches parameter matcher for matching regular expressions.</p>
651
+ </li></ul>
652
+
653
+ <h1>0.5.3 (r165)</h1>
654
+ <ul><li>
655
+ <p>Attempt to fix packaging problems by switching to newer version (1.15.1) of
656
+ gnutar and setting COPY_EXTENDED_ATTRIBUTES_DISABLE environment variable.</p>
657
+ </li><li>
658
+ <p>Removed unused ExpectationSequenceError exception.</p>
659
+ </li><li>
660
+ <p>Added instance_of and kind_of parameter matchers.</p>
661
+ </li><li>
662
+ <p>Added Google Webmaster meta tag to rdoc template header.</p>
663
+ </li><li>
664
+ <p>Put Google Webmaster meta tag in the right header i.e. the one for the
665
+ index page.</p>
666
+ </li></ul>
667
+
668
+ <h1>0.5.2 (r159)</h1>
669
+ <ul><li>
670
+ <p>Fix bug 11885 - “never doesn’t work with stub_everything” submitted by
671
+ Alexander Lang. In fixing this bug, also fixed undiscoverd bug where
672
+ expected &amp; actual invocation counts were being incorrectly reported
673
+ which seems to have been introduced when fixes were added for invocation
674
+ dispatch (see MockedMethodDispatchAcceptanceTest).</p>
675
+ </li><li>
676
+ <p>Previously when an expectation did not allow more invocations, it was
677
+ treated as not matching. Now we prefer matching expectations which allow
678
+ more invocations, but still match expectations which cannot allow more
679
+ invocations. I think this may be overcomplicating things, but let’s see how
680
+ it goes.</p>
681
+ </li></ul>
682
+
683
+ <h1>0.5.1 (r149)</h1>
684
+ <ul><li>
685
+ <p>Fixed bug #11583 “Mocha 0.5.0 throwing unexpected warnings”. Also switched
686
+ on ruby warning for all rake test tasks. Fixed majority of warnings, but
687
+ some left to fix.</p>
688
+ </li></ul>
689
+
690
+ <h1>0.5.0 (r147)</h1>
691
+ <ul><li>
692
+ <p>Parameter Matchers - I’ve added a few Hamcrest-style parameter matchers
693
+ which are designed to be used inside Expectation#with. The following
694
+ matchers are currently available: anything(), includes(), has_key(),
695
+ has_value(), has_entry(), all_of() &amp; any_of(). More to follow soon. The
696
+ idea is eventually to get rid of the nasty parameter_block option on
697
+ Expectation#with.</p>
698
+
699
+ <p>object = mock() object.expects(:method).with(has_key(‘key_1’))
700
+ object.method(‘key_1’ =&gt; 1, ‘key_2’ =&gt; 2) # no verification error
701
+ raised</p>
702
+
703
+ <p>object = mock() object.expects(:method).with(has_key(‘key_1’))
704
+ object.method(‘key_2’ =&gt; 2) # verification error raised, because method
705
+ was not called with Hash containing key: ‘key_1’</p>
706
+ </li><li>
707
+ <p>Values Returned and Exceptions Raised on Consecutive Invocations - Allow
708
+ multiple calls to Expectation#returns and Expectation#raises to build up a
709
+ sequence of responses to invocations on the mock. Added syntactic sugar
710
+ method Expectation#then to allow more readable expectations.</p>
711
+
712
+ <p>object = mock() object.stubs(:method).returns(1,
713
+ 2).then.raises(Exception).then.returns(4) object.method # =&gt; 1
714
+ object.method # =&gt; 2 object.method # =&gt; raises exception of class
715
+ Exception object.method # =&gt; 4</p>
716
+ </li><li>
717
+ <p>Yields on Consecutive Invocations - Allow multiple calls to yields on
718
+ single expectation to allow yield parameters to be specified for
719
+ consecutive invocations.</p>
720
+
721
+ <p>object = mock() object.stubs(:method).yields(1, 2).then.yields(3)
722
+ object.method { |*values| p values } # =&gt; [1, 2] object.method {
723
+ |*values| p values } # =&gt; [3]</p>
724
+ </li><li>
725
+ <p>Multiple Yields on Single Invocation - Added Expectation#multiple_yields to
726
+ allow a mocked or stubbed method to yield multiple times for a single
727
+ invocation.</p>
728
+
729
+ <p>object = mock() object.stubs(:method).multiple_yields([1, 2], [3])
730
+ object.method { |*values| p values } # =&gt; [1, 2] # =&gt; [3]</p>
731
+ </li><li>
732
+ <p>Invocation Dispatch - Expectations were already being matched in reverse
733
+ order i.e. the most recently defined one was being found first. This is
734
+ still the case, but we now stop matching an expectation when its maximum
735
+ number of expected invocations is reached. c.f. JMock v1. A stub will never
736
+ stop matching by default. Hopefully this means we can soon get rid of the
737
+ need to pass a Proc to Expectation#returns.</p>
738
+
739
+ <p>object = mock() object.stubs(:method).returns(2)
740
+ object.expects(:method).once.returns(1) object.method # =&gt; 1
741
+ object.method # =&gt; 2 object.method # =&gt; 2 # no verification error
742
+ raised</p>
743
+
744
+ <p># The following should still work…</p>
745
+
746
+ <p>Time.stubs(:now).returns(Time.parse(‘Mon Jan 01 00:00:00 UTC 2007’))
747
+ Time.now # =&gt; Mon Jan 01 00:00:00 UTC 2007
748
+ Time.stubs(:now).returns(Time.parse(‘Thu Feb 01 00:00:00 UTC 2007’))
749
+ Time.now # =&gt; Thu Feb 01 00:00:00 UTC 2007</p>
750
+ </li><li>
751
+ <p>Deprecate passing an instance of Proc to Expectation#returns.</p>
752
+ </li><li>
753
+ <p>Explicitly include all Rakefile dependencies in project.</p>
754
+ </li><li>
755
+ <p>Fixed old Stubba example.</p>
756
+ </li><li>
757
+ <p>Fix so that it is possible for a stubbed method to raise an Interrupt
758
+ exception without a message in Ruby 1.8.6</p>
759
+ </li><li>
760
+ <p>Added responds_like and quacks_like.</p>
761
+ </li><li>
762
+ <p>Capture standard object methods before Mocha adds any.</p>
763
+ </li><li>
764
+ <p>Added Expectation#once method to make interface less surprising.</p>
765
+ </li><li>
766
+ <p>Use Rake::TestTask to run tests. Created three separate tasks to run unit,
767
+ integration &amp; acceptance tests. Split inspect_test into one file per
768
+ TestCase. Deleted superfluous all_tests file.</p>
769
+ </li><li>
770
+ <p>Fiddled with mocha_inspect and tests to give more sensible results on x86
771
+ platform.</p>
772
+ </li><li>
773
+ <p>Fixed bug #7834 “infinite_range.rb makes incorrect assumption about to_f”
774
+ logged by James Moore.</p>
775
+ </li></ul>
776
+
777
+ <h1>0.4.0 (r92)</h1>
778
+ <ul><li>
779
+ <p>Allow naming of mocks (patch from Chris Roos).</p>
780
+ </li><li>
781
+ <p>Specify multiple return values for consecutive calls.</p>
782
+ </li><li>
783
+ <p>Improved consistency of expectation error messages.</p>
784
+ </li><li>
785
+ <p>Allow mocking of Object instance methods e.g. kind_of?, type.</p>
786
+ </li><li>
787
+ <p>Provide aliased versions of #expects and #stubs to allow mocking of these
788
+ methods.</p>
789
+ </li><li>
790
+ <p>Added at_least, at_most, at_most_once methods to expectation.</p>
791
+ </li><li>
792
+ <p>Allow expects and stubs to take a hash of method and return values.</p>
793
+ </li><li>
794
+ <p>Eliminate warning: “instance variable @yield not initialized” (patch from
795
+ Xavier Shay).</p>
796
+ </li><li>
797
+ <p>Restore instance methods on partial mocks (patch from Chris Roos).</p>
798
+ </li><li>
799
+ <p>Allow stubbing of a method with non-word characters in its name (patch from
800
+ Paul Battley).</p>
801
+ </li><li>
802
+ <p>Removed coupling to Test::Unit.</p>
803
+ </li><li>
804
+ <p>Allow specified exception instance to be raised (patch from Chris Roos).</p>
805
+ </li><li>
806
+ <p>Make mock object_id appear in hex like normal Ruby inspect (patch from Paul
807
+ Battley).</p>
808
+ </li><li>
809
+ <p>Fix path to object.rb in rdoc rake task (patch from Tomas Pospisek).</p>
810
+ </li><li>
811
+ <p>Reverse order in which expectations are matched, so that last expectation
812
+ is matched first. This allows e.g. a call to #stubs to be effectively
813
+ overridden by a call to #expects (patch from Tobias Lutke).</p>
814
+ </li><li>
815
+ <p>Stubba &amp; SmartTestCase modules incorporated into Mocha module so only
816
+ need to require ‘mocha’ - no longer need to require ‘stubba’.</p>
817
+ </li><li>
818
+ <p>AutoMocha removed.</p>
819
+ </li></ul>
820
+
821
+ <h1>0.3.3</h1>
822
+ <ul><li>
823
+ <p>Quick bug fix to restore instance methods on partial mocks (for Kevin
824
+ Clark).</p>
825
+ </li></ul>
826
+
827
+ <h1>0.3.2</h1>
828
+ <ul><li>
829
+ <p>Examples added.</p>
830
+ </li></ul>
831
+
832
+ <h1>0.3.1</h1>
833
+ <ul><li>
834
+ <p>Dual licensing with MIT license added.</p>
835
+ </li></ul>
836
+
837
+ <h1>0.3.0</h1>
838
+ <ul><li>
839
+ <p>Rails plugin.</p>
840
+ </li><li>
841
+ <p>Auto-verify for expectations on concrete classes.</p>
842
+ </li><li>
843
+ <p>Include each expectation verification in the test result assertion count.</p>
844
+ </li><li>
845
+ <p>Filter out noise from assertion backtraces.</p>
846
+ </li><li>
847
+ <p>Point assertion backtrace to line where failing expectation was created.</p>
848
+ </li><li>
849
+ <p>New yields method for expectations.</p>
850
+ </li><li>
851
+ <p>Create stubs which stub all method calls.</p>
852
+ </li><li>
853
+ <p>Mocks now respond_to? expected methods.</p>
854
+ </li></ul>
855
+
856
+ <h1>0.2.1</h1>
857
+ <ul><li>
858
+ <p>Rename MochaAcceptanceTest::Rover#move method to avoid conflict with Rake
859
+ (in Ruby 1.8.4 only?)</p>
860
+ </li></ul>
861
+
862
+ <h1>0.2.0</h1>
863
+ <ul><li>
864
+ <p>Small change to SetupAndTeardown#teardown_stubs suggested by Luke Redpath
865
+ (<a href="http://www.lukeredpath.co.uk">www.lukeredpath.co.uk</a>) to allow
866
+ use of Stubba with RSpec (<a
867
+ href="http://rspec.rubyforge.org">rspec.rubyforge.org</a>).</p>
868
+ </li><li>
869
+ <p>Reorganized directory structure and extracted addition of setup and
870
+ teardown methods into SmartTestCase mini-library.</p>
871
+ </li><li>
872
+ <p>Addition of auto-verify for Mocha (but not Stubba). This means there is
873
+ more significance in the choice of expects or stubs in that any expects on
874
+ a mock will automatically get verified.</p>
875
+ </li></ul>
876
+
877
+ <p>So instead of…</p>
878
+
879
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='const'>Mocha</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
880
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
881
+ <span class='id identifier rubyid_doobrey'>doobrey</span> <span class='op'>=</span> <span class='const'>Doobrey</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_wotsit'>wotsit</span><span class='rparen'>)</span>
882
+ <span class='id identifier rubyid_doobrey'>doobrey</span><span class='period'>.</span><span class='id identifier rubyid_hoojamaflip'>hoojamaflip</span>
883
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_verify'>verify</span></code></pre>
884
+
885
+ <p>you need to do…</p>
886
+
887
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
888
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
889
+ <span class='id identifier rubyid_doobrey'>doobrey</span> <span class='op'>=</span> <span class='const'>Doobrey</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_wotsit'>wotsit</span><span class='rparen'>)</span>
890
+ <span class='id identifier rubyid_doobrey'>doobrey</span><span class='period'>.</span><span class='id identifier rubyid_hoojamaflip'>hoojamaflip</span>
891
+ <span class='comment'># no need to verify</span></code></pre>
892
+
893
+ <p>There are also shortcuts as follows…</p>
894
+
895
+ <p>instead of…</p>
896
+
897
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='const'>Mocha</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
898
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
899
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:summat</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>25</span><span class='rparen'>)</span></code></pre>
900
+
901
+ <p>you can have…</p>
902
+
903
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span> <span class='op'>=&gt;</span> <span class='int'>5</span><span class='comma'>,</span> <span class='symbol'>:summat</span> <span class='op'>=&gt;</span> <span class='int'>25</span><span class='rparen'>)</span></code></pre>
904
+
905
+ <p>and instead of…</p>
906
+
907
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='const'>Mocha</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
908
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
909
+ <span class='id identifier rubyid_wotsit'>wotsit</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:summat</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>25</span><span class='rparen'>)</span></code></pre>
910
+
911
+ <p>you can have…</p>
912
+
913
+ <pre class="code ruby"><code><span class='id identifier rubyid_wotsit'>wotsit</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='symbol'>:thingummy</span> <span class='op'>=&gt;</span> <span class='int'>5</span><span class='comma'>,</span> <span class='symbol'>:summat</span> <span class='op'>=&gt;</span> <span class='int'>25</span><span class='rparen'>)</span></code></pre>
914
+
915
+ <h1>0.1.2</h1>
916
+ <ul><li>
917
+ <p>Minor tweaks</p>
918
+ </li></ul>
919
+
920
+ <h1>0.1.1</h1>
921
+ <ul><li>
922
+ <p>Initial release.</p>
923
+ </li></ul>
924
+ </div></div>
925
+
926
+ <div id="footer">
927
+ Generated on Thu Apr 19 10:54:33 2012 by
928
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
929
+ 0.7.5 (ruby-1.9.3).
930
+ </div>
931
+
932
+ </body>
933
+ </html>