Mocha Releases 0.10.0 - 0.10.5

Belated update on recent releases.

Release Notes


  • 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.
  • 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.
  • Add links to README for source code & issue tracker.
  • Fix for issue #67 – Make the travis-ci badge visible in the README. Thanks to Diego Plentz for pull request.
  • Fix for issue #70 – Rename Mock#expectations to Mock#__expectations__ to avoid conflicts. Thanks to Jeremy Stephens for pull request.


  • Fix for issue #65 – expectations not being verified in subsequent tests.
  • Fix for issue #63 – require Mocha::Mockery at Mocha::Mock class load time and not on invocation of Mock#method_missing.
  • Fix for issue #45 – raise ArgumentError if Mocha::ParameterMatchers#has_entry is given
    Hash with wrong number of entries.
  • Make global variable name more obscure to avoid clashes with other libraries.
  • Move travis-ci-related gemfiles into their own directory.


  • 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 or 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.


  • Merge pull request #53. Unstubbing a method should not remove expectations for other stubbed methods. Fixes #52. Thanks to @saikat.


  • Merge pull request #51. Use Gem::Requirement & Gem::Version for version comparison. Fixes issue #50. Thanks to @meineerde.
  • Fixed typo in rdoc for Mocha::ObjectMethods.
  • Improve README as suggested in issue #46. Explain that Mocha must be loaded after test libraries and how to achieve this using Bundler.
  • Merge pull request #43 – nobody expects the spanish inquisition! Thanks to @cairo140.
  • Fix for issue #39 – improve documentation for Expectation#multiple_yields.
  • Fix for issue #38 where a subtle change in test-unit v2.3.0 had been missed – only visible in verbose mode.
  • Support for MiniTest up to v2.6.2 has been verified.
  • Add explicit development dependency on coderay for generating syntax-highlighted code examples.


  • Add Expectation#throws to allow a stubbed method to use Kernel#throw.
  • Updates for versions of Test::Unit up to and including v2.3.3 (including patch by Jens Fahnenbruck).
  • Updates for versions of MiniTest up to and including v2.5.1.
  • 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 – See issue #20 (thanks to @nicklewis).
  • Handle stubbing of a singleton method, leaving the original method unchanged after the test.
  • When stubbing an instance method that was originally defined as a singleton method, the original method should still exist after the test.
  • Fixed mis-print in Mocha::ObjectMethods#unstub documentation (patch by @glebpom).
  • 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).
  • Added configuration for Travis continuous integration.
  • Make the gemspec the canonical reference and stop generating it from the Rakefile.
  • Use the built-in Bundler rake tasks for packaging the gem.
  • Use the release rake task provided by Bundler instead of using the Rake::XForge::Release functionality.
  • Extract Object#__metaclass__ into a new metaclass gem.
  • Run rake tasks without bundle exec.
  • Avoid deprecation warning for rdoc rake task.
  • 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.
  • Use multiple Gemfiles seems to run Travis CI builds against multiple version of test-unit & minitest.