So I finally got round to releasing a new
version<http://rubyforge.org/frs/?group_id=1917&release_id=9184>of
Mocha <http://mocha.rubyforge.org/>. Much of the functionality has been
available for some time if you''ve been using the Rails plugin based on
subversion HEAD, but now you can get it in all in a gem (or other package).
The most recent changes centre around allowing mocking of Object instance
methods.
Release notes?
- Allow naming of mocks (patch from Chris
Roos<http://blog.seagul.co.uk/>
).
- Specify multiple return values for consecutive calls.
- Improved consistency of expectation error messages.
- Allow mocking of Object instance methods e.g. kind_of?, type.
- Provide aliased versions of #expects and #stubs to allow mocking of
these methods.
- Added at_least, at_most, at_most_once methods to expectation.
- Allow expects and stubs to take a hash of method and return values.
- Eliminate warning: "instance variable @yield not initialized"
(patch
from Xavier Shay <http://blog.rhnh.net/>).
- Restore instance methods on partial mocks (patch from Chris
Roos<http://blog.seagul.co.uk/>
).
- Allow stubbing of a method with non-word chars in its name (patch
from Paul Battley <http://po-ru.com/>).
- Removed coupling to
Test::Unit<http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html>
.
- Allow specified exception instance to be raised (patch from Chris
Roos <http://blog.seagul.co.uk/>).
- Make mock object_id appear in hex like normal Ruby inspect (patch
from Paul Battley <http://po-ru.com/>).
- Fix path to object.rb in rdoc rake task (patch from Tomas
Pospisek<http://www.workingwithrails.com/person/5103-tomas-pospisek>
).
- 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<http://blog.leetsoft.com/>
).
- Stubba & SmartTestCase modules incorporated into Mocha module so
only need to require ''mocha'' ? no longer need to require
''stubba''.
- AutoMocha removed.
Thanks to all who contributed.
Enjoy :-)
I''ve created a mocha_release category on my blog, so if you want
notification of new releases you can subscribe to
http://blog.floehopper.org/xml/atom/category/mocha_release/feed.xml
--
James.
http://blog.floehopper.org