mocha 0.11.3 → 0.11.4

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