Skip to content


Subversion checkout URL

You can clone with
Download ZIP
100644 383 lines (297 sloc) 29.968 kB
24314c2 @floehopper Add SHA to release notes for v0.10.5.
floehopper authored
1 = 0.10.5 (a5a64cf9755b21d4a30e446232654d1c0fc6f151)
a5a64cf @floehopper Bump version to 0.10.5 and prepare for release.
floehopper authored
2 * Fix for issue #66 (hopefully without regressing on issue #63) - Mocha::Mock has Mocha::Mockery as a dependency. Stop trying to pretend otherwise. Thanks to @kennyj for reporting.
3 * Fix a bunch of warnings in Ruby 1.9. There are still the 6 test failures mentioned in issue #41 which I suspect are due to the introspection gem not being Ruby 1.9-compatible.
4 * Add links to README for source code & issue tracker.
5 * Fix for issue #67 - Make the travis-ci badge visible in the README. Thanks to Diego Plentz for pull request.
6 * Fix for issue #70 - Rename Mock#expectations to Mock#__expectations__ to avoid conflicts. Thanks to Jeremy Stephens for pull request.
8251445 @floehopper Add SHA to release notes for v0.10.4.
floehopper authored
8 = 0.10.4 (babdd656c361ac65f25948104adf612e59174a5e)
a5a64cf @floehopper Bump version to 0.10.5 and prepare for release.
floehopper authored
9 * Fix for issue #65 - expectations not being verified in subsequent tests.
babdd65 @floehopper Bump version to 0.10.4 and prepare for release.
floehopper authored
10 * Fix for issue #63 - require Mocha::Mockery at Mocha::Mock class load time and not on invocation of Mock#method_missing.
11 * Fix for issue #45 - raise ArgumentError if Mocha::ParameterMatchers#has_entry is given
12 Hash with wrong number of entries.
13 * Make global variable name more obscure to avoid clashes with other libraries.
14 * Move travis-ci-related gemfiles into their own directory.
9733d75 @floehopper Add SHA to release notes for v0.10.3.
floehopper authored
16 = 0.10.3 (e7f88af8e7c3396bc85fe9f9cb9e5f5fef04bea2)
e7f88af @floehopper Bump version to 0.10.3 and prepare for release.
floehopper authored
17 * Fix for issue #57. Gem::Requirement#=~ was only added in rubygems v1.8.0, but Object#=~ means the result of various monkey-patching checks is always false/nil for earlier versions of rubygems. However, the method it aliases #satisfied_by? has existed since Gem::Dependency was extracted from Gem::Version in rubygems v0.9.4.4, so it's much safer to use that. Thanks to fguillen for reporting and helping with diagnosis.
faf46fd @floehopper Add SHA to release notes for v0.10.2.
floehopper authored
19 = 0.10.2 (e05d9a555f1cf97c5961900dab0d884e9753257b)
e05d9a5 @floehopper Bump version to 0.10.2 and prepare for release.
floehopper authored
20 * Merge pull request #53. Unstubbing a method should not remove expectations for other stubbed methods. Fixes #52. Thanks to saikat.
4963a34 @floehopper Add SHA to release notes for v0.10.1.
floehopper authored
22 = 0.10.1 (f631a4ba22c6ed4929c52b0520311a9a84034a20)
e05d9a5 @floehopper Bump version to 0.10.2 and prepare for release.
floehopper authored
23 * Merge pull request #51. Use Gem::Requirement & Gem::Version for version comparison. Fixes issue #50. Thanks to meineerde.
f631a4b @floehopper Bump version to 0.10.1 and prepare for release.
floehopper authored
24 * Fixed typo in rdoc for Mocha::ObjectMethods.
25 * Improve README as suggested in issue #46. Explain that Mocha must be loaded after test libraries and how to achieve this using Bundler.
26 * Merge pull request #43 - nobody expects the spanish inquisition! Thanks to cairo140.
27 * Fix for issue #39 - improve documentation for Expectation#multiple_yields.
28 * Fix for issue #38 where a subtle change in test-unit v2.3.0 had been missed - only visible in verbose mode.
29 * Support for MiniTest up to v2.6.2 has been verified.
30 * Add explicit development dependency on coderay for generating syntax-highlighted code examples.
8bafa63 @floehopper Add SHA to release notes.
floehopper authored
32 = 0.10.0 (68a4a59e1af74baf3929af418f73f5627bba548d)
68a4a59 @floehopper Bump version to 0.10.0 and prepare for release.
floehopper authored
33 * Add Expectation#throws to allow a stubbed method to use Kernel#throw.
34 * Updates for versions of Test::Unit up to and including v2.3.3 (including patch by Jens Fahnenbruck).
35 * Updates for versions of MiniTest up to and including v2.5.1.
36 * Since the singleton method added by Mocha masks the underlying instance method, there's no need to move it out the way and then back again. This fixes Github issue #20, because the original method is left unchanged - (thanks to Nick Lewis).
37 * Handle stubbing of a singleton method, leaving the original method unchanged after the test.
38 * When stubbing an instance method that was originally defined as a singleton method, the original method should still exist after the test.
39 * Fixed mis-print in Mocha::ObjectMethods#unstub documentation (patch by Gleb Pomykalov).
40 * Improved test coverage around stubbing of methods defined in different ways - this makes use of the newly extracted introspection gem (although this means some tests are now failing in Ruby v1.9.2).
41 * Added configuration for Travis continuous integration.
42 * Make the gemspec the canonical reference and stop generating it from the Rakefile.
43 * Use the built-in Bundler rake tasks for packaging the gem.
44 * Use the "release" rake task provided by Bundler instead of using the Rake::XForge::Release functionality.
45 * Extract Object#__metaclass__ into a new metaclass gem.
46 * Run rake tasks without `bundle exec`.
47 * Avoid deprecation warning for rdoc rake task.
48 * Remove the `use_test_unit_gem` MOCHA_OPTION which hasn't worked since we switched to bundler - we can now run the tests specifying a different Gemfile instead.
49 * Use multiple Gemfiles seems to run Travis CI builds against multiple version of test-unit & minitest.
6f18b72 @floehopper Add SHA to release notes and include updated gemspec.
floehopper authored
51 = 0.9.12 (8bb523e8467626c23b271eb529c33fb118e368fe)
8bb523e @floehopper Bump version to 0.9.12 and prepare for release.
floehopper authored
52 * Make Mocha's tests pass under Ruby 1.9.2 i.e. using MiniTest. One of the main issues was that we were not parsing stacktraces on MiniTest errors comprehensively enough.
53 * Avoid 'circular require considered harmful' warning when running Mocha's tests in Ruby 1.9.2
54 * Make performance tests work on Ruby 1.9.2 i.e. using MiniTest.
55 * Declare rake as a *development* dependency with newer versions of Rubygems since it's only needed to carry out developer-related tasks.
aae7fdf @floehopper Updated release notes with commit SHA.
floehopper authored
57 = 0.9.11 (1613ed2267fef5927ea06adfdbcf512b89eadaad)
4015742 @floehopper Bumped version to 0.9.11 and updated release notes and gemspec in pre…
floehopper authored
58 * Added explicit support for minitest v1.5.0 to v2.0.2.
59 * Make testable by rubygems-test.
60 * Update links to my blog and make other links consistent.
61 * Added a URI parameter matcher that ignores the order of query parameters so that tests can be independent of undefined hash ordering (patch by Paul Battley).
62 * Include unexpected invocation in failure message and change the language slightly to make the failure message less confusing. See
63 * No need to create regular expression every time the BacktraceFilter#filtered method is called. See
f397388 @floehopper Added SHA1 for 0.9.10 to release notes.
floehopper authored
65 = 0.9.10 (31182ea8b38b79aa50702aa839f6a29ebcf7d684)
31182ea @floehopper Bumped version to 0.9.10 and updated release notes and gemspec in pre…
floehopper authored
66 * Added Mocha::ObjectMethods#unstub method -
67 * Inherit Mocha::ExpectationError from Exception instead of StandardError to reduce the chances of a test passing by accident - thanks to James Sanders (jsanders) -
68 * Fixed bug - GitHub README page to link correctly to code examples -
69 * Fixed bug - PASSTHROUGH_EXCEPTIONS are defined on MiniTest::Unit::TestCase not in Mocha - thanks to Brian Troutwine (blt) -
48ab59a @floehopper Add commit SHA1 for 0.9.9 to release notes.
floehopper authored
71 = 0.9.9 (ee3a79db4d52c3339e8acf07505e01236a2b4810)
c0cf25b @floehopper Added release notes for v0.9.9.
floehopper authored
72 * Avoid loading bits of the test-unit gem by accident. This is an attempt at a fix for the problem that James Adam reported [1]. By using 'load' instead of 'require' to detect the version of Test::Unit, we can avoid rubygems trying to load bits of the test-unit gem when it's not wanted. [1]
73 * Fix exception when running rake without test-unit gem. When test-unit gem >=v2.0.0 was installed but the "use_test_unit_gem" MOCHA_OPTIONS was not specified, a "comparison of Fixnum with Hash failed" exception was being raised when running the performance tests. This was because bits of the test-unit gem were being loaded accidentally and a Hash was being incorrectly supplied to the method.
74 * Explicitly require rubygems for running tests via rake using test-unit gem.
75 * Handle newer versions of test-unit gem (v2.0.2 to v2.0.9)
76 * Handle newer versions of minitest gem (v1.4.0 to v1.6.0)
77 * Added warnings about monkey-patching test-unit and minitest to aid debugging. These are enabled by including "debug" in the MOCHA_OPTIONS environment variable. This is now a comma-separated list, so that we can specify multiple options e.g. MOCHA_OPTIONS=debug,use_test_unit_gem
78 * Eloy Duran (alloy) made the unit tests run on 1.9.2dev r25249.
79 * Eloy Duran (alloy) also improved some MiniTest TestResult code I'd written and got the acceptance tests running on Ruby 1.9 HEAD. There are still 4 failures because for some reason the backtrace line numbers are off by one. And the minitest_test test case does not run when the whole suite is run with MiniTest. These issues still need investigation.
80 * Fixed some acceptance tests to run in Ruby 1.9.2 - it's no longer possible to subvert the protection of a method by calling it via Object#send.
81 * Fixed "test:performance" rake task so it runs in Ruby 1.9.2.
82 * Fix test incorrectly failing under Rubinius 1.0. This test imposed too many constraints. It appears that Object#inspect legitimately calls Object#object_id in Rubinius. But we're only interested in what 'id' methods Mocha::ObjectMethods#mocha_inspect calls. By stubbing Object#inspect we can relax the constraints imposed by the test.
83 * Luke Redpath (lukeredpath) added new shorthand "any" and "all" composite parameter matchers using "&" and "|". This provides an alternative syntax for expecting any or all matchers to pass, e.g. foo.expects(:bar).with(equals(1) | equals(2)).
84 * Improved documentation for Expectation#raises. A number of people have suggested an extension to the API to cope with custom exceptions that have extra constructor parameters. However, since the arguments supplied to Expectation#raises are just passed on to Kernel#raise, it's possible to pass in an instance of an exception. Thus no change to the API is required, but it does seem worthwhile pointing this out in the docs.
85 * Corrected RDoc example for Expectation#never thanks to Red David (reddavis).
86 * Improved RDoc including a change suggested by Rohit Arondekar (rohit).
87 * Updated gemspec as requested by Sam Woodard (shwoodard).
fc3b9ba @floehopper Add commit SHA1 for 0.9.8 to release notes.
floehopper authored
89 = 0.9.8 (645024765b2d92018efc511652e1174163844e39)
6450247 @floehopper Fixed Rails plugin which stopped working after 0.9.6. Updated documen…
floehopper authored
90 * Fixed bug "NameError raised when using Mocha as a Rails plug-in" - Since 0.9.6 the Rails plugin has been broken. See bug report for details. You will need to explicitly load Mocha *after* the test framework has been loaded, e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb.
91 * Make Mocha::ParameterMatchers#regexp_matches, #includes, #has_value, #has_key more robust. Thanks to Sander Hartlage.
92 * Allow passing a block to Mocha::Configuration methods to only change configuration for the duration of the block. Thanks to Dan Manges.
93 * Fixed bug "doc generation fails in 0.9.7 gem" -
94 * Remove rdoc template incorporating google analytics from source control. The file just needs to exist locally and be ignored by source control. This should stop the warning showing up on e.g. RunCodeRun build results.
b0dc908 @floehopper Updated release notes for 0.9.7.
floehopper authored
96 = 0.9.7 (80d816f250dc13aaf856f3f9cbd97ebe9c371839)
80d816f @floehopper Prepare for 0.9.7 release.
floehopper authored
97 * Although I had provided a deprecation warning for people using Mocha::Standalone, I had assumed people wouldn't be explicitly loading the mocha/standalone.rb file. It turns out this assumption was incorrect at least in the case of Rspec. This is now fixed.
6f5890a @floehopper Update gemspec and release notes to reflect 0.9.6 release.
floehopper authored
99 = 0.9.6 (57f8f77d715b7f1d9efee2e1a9438f7905c0006b)
57f8f77 @floehopper Prepare for 0.9.6 release.
floehopper authored
100 * Version 2.0.1 of the test-unit gem introduced a private 'run_test' method on TestCase which clashed with the public TestRunner#run_test method. So this latter method has been renamed to 'run_as_test'.
101 * Stop requiring rubygems - this should be an environmental choice for the user. - describes why requiring rubygems in your library code is a bad idea.
102 * It seems like overkill to vendorize coderay and meta_project when they're only needed to generate the examples for documentation and for publishing files on RubyForge. So I'm removing them and installing them locally as gems when I need them.
103 * Added support for 'test-unit' gem (version >= 2.0). Note that as with other versions of Test::Unit I'm completely replacing the TestCase#run method. Unfortunately in version 2.0.0 this method differs slightly from the same method in version 2.0.1 & 2.0.2, so we have to provide different implementations to ensure that the internal working of Test::Unit are not compromised by Mocha. Note also that unless the 'test-unit' gem is loaded, requiring 'test/unit' leads to a mixture of stdlib and gem classes being loaded causing errors. To avoid a dependency on rubygems, the gem is loaded only if MOCHA_OPTIONS is set to 'use_test_unit_gem' - this option is only intended for use in running Mocha's own tests. It might be worthwhile to create a shim gem like minitest_tu_shim to allow the test-unit gem to completely replace the stdlib, but that's a job for another day. The changes in the Rakefile are to make the default task run with the 'test-unit' gem (version >= 2.0).
104 * Renamed Mocha::Standalone to Mocha::API to better reflect its purpose. Added a deprecation warning for those who are referencing Mocha::Standalone.
105 * Fix exception raised by HasEntry#matches? if first param is not a Hash (thanks to Taylor Barstow).
106 * Ken Collins reported [1] that Mocha is always loading MiniTest if it is available and loading it causes some Rails/ActionPack tests to break. I've removed the loading of MiniTest, but this now means the user has to ensure that if they want to use MiniTest in conjunction with Mocha, he must load MiniTest before loading Mocha. [1]
107 * Implemented Bacon integration (thanks to Ubiratan Pires Alberton), but this was then removed after deciding only to maintain integration with Test::Unit and MiniTest which are both Ruby standard libraries. See mailing list for details.
108 * Don't monkey-patch MiniTest if it's already been monkey-patched by Mocha.
109 * Fixed bug: MiniTest integration was counting ExpectationErrors as errors not failures.
110 * Fixed bug: Some Bacon tests were failing in Ruby 1.9.1.
111 * Chad Humphries pointed out that in Ruby 1.9.1, if you are not using Test::Unit or MiniTest, Mocha will attempt to load and monkey-patch Test::Unit. Mocha will now only monkey-patch Test::Unit and/or MiniTest if they have already been loaded. MiniTest tests will now run in both Ruby 1.8.6 (with MiniTest gem) and in Ruby 1.9.1 (with MiniTest std lib). See Ligthouse ticket -
112 * Made Mocha compatible with minitest 1.4.0 and above (thanks to Denis Defreyne).
16def14 @floehopper Updated release notes to include later commit for 0.9.5.
floehopper authored
114 = 0.9.5 (93cad010345ce5d68f31422cfc32ed9dd6de13ec)
6242447 @floehopper Prepare for 0.9.5 release.
floehopper authored
115 * Fixed Lighthouse bug #32 - stub_everything should mean mock responds to anything.
52c5752 @floehopper Minor corrections to release notes.
floehopper authored
116 * Added Expectation#twice to improve readability. Thanks to pull request from Celestino Gomes.
117 * In Ruby 1.9.1, requiring 'test/unit' loads a thin wrapper around MiniTest and Test::Unit::TestCase ends up inheriting from MiniTest::Unit::TestCase. So we need to avoid including the Mocha modules more than once to avoid nasty consequences. Thanks to Matthias Hennemeyer for help with this.
6242447 @floehopper Prepare for 0.9.5 release.
floehopper authored
118 * Ruby 1.9 includes rake, but not rake/contrib. For the moment I've moved the sshpublisher require into the only rake task that needs it, so that I can at least run the tests in Ruby 1.9. It looks like I will need to build a rake/contrib gem or similar to get this working properly -
33253b1 @floehopper Prepare for 0.9.4 release.
floehopper authored
120 = 0.9.4 (8a59c6ff0f99f34b02bd99f19536a7893be2b340)
121 * Added mocha.gemspec file generated with Chad Woolley's new rake task, so that a floehopper-mocha gem will get built on GitHub.
122 * Add rake task to update mocha.gemspec with unique version, which will cause gem to be auto-built on github
123 * As Tobias Crawley correctly pointed out in feature request #23055 "stubs(with_hash) not working with existing object" [1], following the principle of least surprise, it should be possible to call ObjectMethods#expects & ObjectMethods#stubs with a Hash of method_names vs return_values like you can with Mock#expects & Mock#stubs. I've also updated & improved the docs to reflect the changes. [1]
124 * Removed deprecated gem autorequire.
d4a5b3e @floehopper Removed deprecated gem autorequire and updated RELEASE.
floehopper authored
126 = 0.9.3 (8219bb2d2881c8529c93fc21e97a11d01203c759)
6242447 @floehopper Prepare for 0.9.5 release.
floehopper authored
127 * Added support for MiniTest thanks to Jeff Smick.
b286ee0 @floehopper Preparing for 0.9.3 release.
floehopper authored
128 * Fixed a possible bug with some of the non-default Configuration options relating to the argument to Object#respond_to?
129 * As per Jay Fields recommendations [1] and with further impetus from a talk at Ruby Manor, any methods added to core classes are now added by including a module. This means that Mocha is a better citizen of the Ruby world and it's behaviour is more easily extended. [1] &
d4a5b3e @floehopper Removed deprecated gem autorequire and updated RELEASE.
floehopper authored
130 * Removed deprecated gem autorequire.
b286ee0 @floehopper Preparing for 0.9.3 release.
floehopper authored
2850298 Gem::manage_gems is deprecated.
jamesmead authored
132 = 0.9.2 (r355)
d53b6ca Updated version to 0.9.2 and added release notes.
jamesmead authored
133 * Improved documentation to address [#22530] 'Mock methods with multiple return values not possible?'
134 * respond_with parameter matcher was not available in tests.
135 * Patch [#22630] Fix for a bug in running Rails tests with Ruby 1.8.7. Array#flatten was being called which in turn was checking whether each element responded to #to_ary. This check was using the two parameter version of #respond_to?, but Mock was only defining a one parameter version.
14bfb88 @floehopper Add release notes for 0.9.1
floehopper authored
137 = 0.9.1 (r349)
139 * Fixed bug #21465 - expects & stubs should support method names as strings (as well as symbols) or fail fast. Convert all expectation method names to a symbol in case they were supplied as a string.
140 * By removing Mock#unexpected_method_called we reduce the number of methods vulnerable to the problem that surfaced in bug #21563.
141 * Fix bug #21563 - stubbing 'verified?' method is unsafe. Instance method names on the Mock class should be more obscure.
142 * Performance improvement. StubbaExampleTest goes twice as fast on my local machine.
143 * Added primitive performance test to default rake task.
144 * Fix format of case statements which don't work in Ruby 1.9 and make others consistent.
145 * There is no point in running (potentially expensive) checks if configuration is set to allow such checks to fail. This is a relatively quick fix in response to Chris McGrath's performance problems.
146 * Fix for bug #21161 - 'uninitialized constant Deprecation in stubba.rb'.
147 * It's more readable to talk about 'once' and 'twice' rather than '1 time' and '2 times'.
148 * Fix bug #20883 - never should raise when called to prevent follow up errors. Fail fast when there are no matching invokable expectations and handle the stub_everything case sensibly. This might not be entirely backwards compatible, but I think the benefits outweigh the risks. The most likely change is that a test that was already failing will now fail faster, which doesn't seem so awful.
9826dd9 @floehopper Updated RELEASE to reflect released revision for 0.9.0.
floehopper authored
150 = 0.9.0 (r316)
85e1a74 @floehopper Updated README.
floehopper authored
152 * Configurable warnings or errors
153 * when a method on a non-public method is stubbed
154 * when a method on a non-existent method is stubbed
155 * when a method on a non-mock object is stubbed
156 * when a method is stubbed unnecessarily (i.e. the stubbed method is not called during the test)
68a4a59 @floehopper Bump version to 0.10.0 and prepare for release.
floehopper authored
85e1a74 @floehopper Updated README.
floehopper authored
158 * Improved error messages
159 * User-friendly list of unsatisfied expectations, satisfied expectations and state machines.
160 * Improved readability of cardinality description.
161 * Display sensible failure message for any_instance expectations e.g. "#<AnyInstance:Foo>.bar - expected calls: 1, actual calls: 0"
163 * Parameter matchers
164 * New to this release
165 * optionally (allows matching of optional parameters if available)
166 * yaml_equivalent (allows matching of YAML that represents the specified object)
167 * responds_with (tests the quack not the duck)
168 * Nesting of parameter matchers is now supported.
170 * Optional block passed into mock initializer is evaluated in the context of the new mock instance and can be used as a shortcut to set up expectations.
172 * Added JMock-style sequences for constraining the order of expected invocations. See Standalone#sequence and Expectation#in_sequence.
174 * Added JMock-style states for constraining the order of expected invocations. See Standalone#states, Expectation#then, Expectation#when and StateMachine.
176 * Compatibility with versions of Ruby
177 * Compatibility with Ruby v1.9. All test errors and warnings fixed.
178 * Nasty fix so that TestCaseAdaptor works consistently with earlier versions of Test::Unit as well as more recent versions.
179 * Added platform to gem specification to avoid bug in rubygems 0.9.5 - see and
180 * Make ExpectationRaiser deal with subclasses of Interrupt which seem to need a message supplied in the raise statement in Ruby 1.8.6 (but not 1.8.4 or 1.9). Not sure this is really Mocha's responsibility.
182 * Added deprecation warning in stubba.rb which is no longer needed and will be removed.
184 * Supply positioning information to evals to improve any error messages. See
186 * Bug fixes
187 * 18914 in revision 296 -
188 * 18917 in revision 295 -
189 * 18336 in revision 287 -
190 * 17835 in revision 255 -
191 * 17412 in revision 242 -
192 * 15977 in revision 198 -
193 * 11885 in revision 156 -
d6a0f26 @floehopper Renamed Matches parameter matcher to RegexpMatches for clarity. Added…
floehopper authored
195 = 0.5.5 (r167)
197 - Renamed Matches parameter matcher to RegexpMatches for clarity.
198 - Added noframes tag to rdoc index to assist Google.
200 = 0.5.4 (r166)
202 - Added matches parameter matcher for matching regular expressions.
bc1013c @floehopper Updated release notes and version number ready for release 0.5.3.
floehopper authored
204 = 0.5.3 (r165)
206 - Attempt to fix packaging problems by switching to newer version (1.15.1) of gnutar and setting COPY_EXTENDED_ATTRIBUTES_DISABLE environment variable.
207 - Removed unused ExpectationSequenceError exception.
208 - Added instance_of and kind_of parameter matchers.
209 - Added Google Webmaster meta tag to rdoc template header.
210 - Put Google Webmaster meta tag in the right header i.e. the one for the index page.
e3cb50a @floehopper Release 0.5.2. Update release notes.
floehopper authored
212 = 0.5.2 (r159)
214 - Fix bug 11885 - "never doesn't work with stub_everything" submitted by Alexander Lang. In fixing this bug, also fixed undiscoverd bug where expected & actual invocation counts were being incorrectly reported which seems to have been introduced when fixes were added for invocation dispatch (see MockedMethodDispatchAcceptanceTest).
215 - Previously when an expectation did not allow more invocations, it was treated as not matching. Now we prefer matching expectations which allow more invocations, but still match expectations which cannot allow more invocations. I think this may be overcomplicating things, but let's see how it goes.
217 = 0.5.1 (r149)
219 - Fixed bug #11583 "Mocha 0.5.0 throwing unexpected warnings". Also switched on ruby warning for all rake test tasks. Fixed majority of warnings, but some left to fix.
221 = 0.5.0 (r147)
223 - Parameter Matchers - I’ve added a few Hamcrest-style parameter matchers which are designed to be used inside Expectation#with. The following matchers are currently available: anything(), includes(), has_key(), has_value(), has_entry(), all_of() & any_of(). More to follow soon. The idea is eventually to get rid of the nasty parameter_block option on Expectation#with.
225 object = mock()
226 object.expects(:method).with(has_key('key_1'))
227 object.method('key_1' => 1, 'key_2' => 2)
228 # no verification error raised
230 object = mock()
231 object.expects(:method).with(has_key('key_1'))
232 object.method('key_2' => 2)
233 # verification error raised, because method was not called with Hash containing key: 'key_1'
235 - Values Returned and Exceptions Raised on Consecutive Invocations - Allow multiple calls to Expectation#returns and Expectation#raises to build up a sequence of responses to invocations on the mock. Added syntactic sugar method Expectation#then to allow more readable expectations.
237 object = mock()
238 object.stubs(:method).returns(1, 2).then.raises(Exception).then.returns(4)
239 object.method # => 1
240 object.method # => 2
241 object.method # => raises exception of class Exception
242 object.method # => 4
244 - Yields on Consecutive Invocations - Allow multiple calls to yields on single expectation to allow yield parameters to be specified for consecutive invocations.
246 object = mock()
247 object.stubs(:method).yields(1, 2).then.yields(3)
248 object.method { |*values| p values } # => [1, 2]
249 object.method { |*values| p values } # => [3]
251 - Multiple Yields on Single Invocation - Added Expectation#multiple_yields to allow a mocked or stubbed method to yield multiple times for a single invocation.
253 object = mock()
254 object.stubs(:method).multiple_yields([1, 2], [3])
255 object.method { |*values| p values } # => [1, 2] # => [3]
257 - Invocation Dispatch - Expectations were already being matched in reverse order i.e. the most recently defined one was being found first. This is still the case, but we now stop matching an expectation when its maximum number of expected invocations is reached. c.f. JMock v1. A stub will never stop matching by default. Hopefully this means we can soon get rid of the need to pass a Proc to Expectation#returns.
259 object = mock()
260 object.stubs(:method).returns(2)
261 object.expects(:method).once.returns(1)
262 object.method # => 1
263 object.method # => 2
264 object.method # => 2
265 # no verification error raised
267 # The following should still work...
269 Time.stubs(:now).returns(Time.parse('Mon Jan 01 00:00:00 UTC 2007'))
270 # => Mon Jan 01 00:00:00 UTC 2007
271 Time.stubs(:now).returns(Time.parse('Thu Feb 01 00:00:00 UTC 2007'))
272 # => Thu Feb 01 00:00:00 UTC 2007
68a4a59 @floehopper Bump version to 0.10.0 and prepare for release.
floehopper authored
e3cb50a @floehopper Release 0.5.2. Update release notes.
floehopper authored
274 - Deprecate passing an instance of Proc to Expectation#returns.
275 - Explicitly include all Rakefile dependencies in project.
276 - Fixed old Stubba example.
277 - Fix so that it is possible for a stubbed method to raise an Interrupt exception without a message in Ruby 1.8.6
278 - Added responds_like and quacks_like.
279 - Capture standard object methods before Mocha adds any.
280 - Added Expectation#once method to make interface less surprising.
281 - Use Rake::TestTask to run tests. Created three separate tasks to run unit, integration & acceptance tests. Split inspect_test into one file per TestCase. Deleted superfluous all_tests file.
282 - Fiddled with mocha_inspect and tests to give more sensible results on x86 platform.
283 - Fixed bug #7834 "infinite_range.rb makes incorrect assumption about to_f" logged by James Moore.
285 = 0.4.0 (r92)
f9fefd2 @floehopper Updated RELEASE for 0.4.0. Tweaked TODO.
floehopper authored
287 - Allow naming of mocks (patch from Chris Roos).
288 - Specify multiple return values for consecutive calls.
289 - Improved consistency of expectation error messages.
290 - Allow mocking of Object instance methods e.g. kind_of?, type.
291 - Provide aliased versions of #expects and #stubs to allow mocking of these methods.
292 - Added at_least, at_most, at_most_once methods to expectation.
293 - Allow expects and stubs to take a hash of method and return values.
294 - Eliminate warning: "instance variable @yield not initialized" (patch from Xavier Shay).
295 - Restore instance methods on partial mocks (patch from Chris Roos).
296 - Allow stubbing of a method with non-word characters in its name (patch from Paul Battley).
297 - Removed coupling to Test::Unit.
298 - Allow specified exception instance to be raised (patch from Chris Roos).
299 - Make mock object_id appear in hex like normal Ruby inspect (patch from Paul Battley).
300 - Fix path to object.rb in rdoc rake task (patch from Tomas Pospisek).
301 - Reverse order in which expectations are matched, so that last expectation is matched first. This allows e.g. a call to #stubs to be effectively overridden by a call to #expects (patch from Tobias Lutke).
302 - Stubba & SmartTestCase modules incorporated into Mocha module so only need to require 'mocha' - no longer need to require 'stubba'.
303 - AutoMocha removed.
305 = 0.3.3
307 - Quick bug fix to restore instance methods on partial mocks (for Kevin Clark).
309 = 0.3.2
311 - Examples added.
313 = 0.3.1
315 - Dual licensing with MIT license added.
4fc1bc3 @floehopper Released 0.3.0
floehopper authored
317 = 0.3.0
319 * Rails plugin.
320 * Auto-verify for expectations on concrete classes.
321 * Include each expectation verification in the test result assertion count.
322 * Filter out noise from assertion backtraces.
323 * Point assertion backtrace to line where failing expectation was created.
324 * New yields method for expectations.
325 * Create stubs which stub all method calls.
326 * Mocks now respond_to? expected methods.
5ade0d0 @floehopper Release 0.2.1
floehopper authored
328 = 0.2.1
330 * Rename MochaAcceptanceTest::Rover#move method to avoid conflict with Rake (in Ruby 1.8.4 only?)
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
332 = 0.2.0
334 * Small change to SetupAndTeardown#teardown_stubs suggested by Luke Redpath ( to allow use of Stubba with RSpec (
335 * Reorganized directory structure and extracted addition of setup and teardown methods into SmartTestCase mini-library.
336 * Addition of auto-verify for Mocha (but not Stubba). This means there is more significance in the choice of expects or stubs in that any expects on a mock will automatically get verified.
338 So instead of...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
340 wotsit =
341 wotsit.expects(:thingummy).with(5).returns(10)
342 doobrey =
343 doobrey.hoojamaflip
344 wotsit.verify
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
346 you need to do...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
348 wotsit = mock()
349 wotsit.expects(:thingummy).with(5).returns(10)
350 doobrey =
351 doobrey.hoojamaflip
352 # no need to verify
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
354 There are also shortcuts as follows...
356 instead of...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
358 wotsit =
359 wotsit.expects(:thingummy).returns(10)
360 wotsit.expects(:summat).returns(25)
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
362 you can have...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
364 wotsit = mock(:thingummy => 5, :summat => 25)
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
366 and instead of...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
368 wotsit =
369 wotsit.stubs(:thingummy).returns(10)
370 wotsit.stubs(:summat).returns(25)
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
372 you can have...
c38bdc6 @floehopper Tweaks so that I can release 0.2.0
floehopper authored
374 wotsit = stub(:thingummy => 5, :summat => 25)
310e3e5 @floehopper Updated docs ready for release 0.2.0
floehopper authored
376 = 0.1.2
378 * Minor tweaks
380 = 0.1.1
382 * Initial release.
Something went wrong with that request. Please try again.