/ruby-mocha, Ruby library for mocking and stubbing
1.2.1, Package name:
ruby22-mocha-1.2.1, Maintainer: pkgsrc-users
Mocha is a Ruby library for mocking and stubbing using a syntax
like that of JMock, and SchMock. Most commonly Mocha is used in
conjunction with Test::Unit, but it can be used in other contexts.
One of its main advantages is that it allows you to mock and stub
methods on real (non-mock) classes and instances. You can for
example stub ActiveRecord instance methods like create, save,
destroy and even class methods like find to avoid hitting the
database in unit tests.
Mocha provides a unified, simple and readable syntax for both
traditional mocking and for mocking with real objects.
Required to run:
Master sites: SHA1:
Version history: (Expand)
- (2016-10-20) Updated to version: ruby22-mocha-1.2.1
- (2015-02-01) Updated to version: ruby200-mocha-1.1.0
- (2014-07-24) Updated to version: ruby200-mocha-1.0.0
- (2014-03-14) Updated to version: ruby193-mocha-1.0.0
- (2013-06-16) Updated to version: ruby193-mocha-0.14.0
- (2013-03-11) Updated to version: ruby193-mocha-0.13.3
CVS history: (Expand)
| 2016-10-20 16:40:39 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to 1.2.1.
* Fixed #272. Workaround Ruby bug 12832 which caused interpreter to hang. See \
https://bugs.ruby-lang.org/issues/12832. Thanks to @chrisroos & @petems \
* Always use prepended module to stub class & instance methods for Ruby v2+ \
- thanks to @grosser & @chrisroos (43d56671, #244)
* Always use prepended module to stub AnyInstance methods in Ruby v2+ - thanks \
to @chrisroos (#262)
* Always set visibility of stub method to match stubbed method on included \
module - thanks to @grosser & @chrisroos (e87c03b0, #248)
* Always set visibility to stub method to match stubbed method on superclass - \
thanks to @chrisroos (38d902ad)
* Allow stubbing of method to which any instance responds (#200)
* Allow `includes` matcher to take matcher arguments - thanks to @lazyatom (#217)
* Avoid exception in older version of Rubygems - thanks to @chrisroos (78d930a7)
* Add licenses to gemspec as requested by @coreyhaines (#201)
* Fix typo in README - thanks to @jaredbeck (6119460d)
* Added section about using Mocha with RSpec & Rails to README (#221)
* Fix documentation for Mocha::API#stub method - thanks to @raeno (599b1dcd)
* Added backers and sponsors from OpenCollective - thanks to @piamancini (#253)
* Fix typo in docs for equals - thanks to @alexcoco (#254)
* Add known issue for Ruby v1.8 to README - thanks to @chrisroos (2c642096)
| 2015-11-03 04:29:40 by Alistair G. Crooks | Files touched by this commit (1995) |
Add SHA512 digests for distfiles for devel category
Issues found with existing distfiles:
No changes made to these distinfo files.
Otherwise, existing SHA1 digests verified and found to be the same on
the machine holding the existing distfiles (morden). All existing
SHA1 digests retained for now as an audit trail.
| 2015-02-01 15:50:43 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to 1.1.0.
# Release Notes
* Set visibility of any instance stub method.
* Stub methods with a prepended method if there are other prepended methods. \
Thanks to @mrsimo.
* Improve docs for `Mock#responds_like` & `#responds_like_instance_of`.
* Use GitHub convention for instructions on contributing to Mocha.
* Fix typos in docs. Thanks to @10io
| 2014-03-14 17:11:22 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha t 1.0.0.
# Release Notes
### External changes
* Assume 'mocha' has been required when requiring 'mocha/setup'.
* Provide shortcuts for integrating with specific test library i.e. `require \
'mocha/test_unit'` or `require 'mocha/mini_test'`
as alternatives to `require 'mocha/setup'`.
* Do not automatically try to integrate with test libraries. Since the automatic \
test library integration functionality
requires the test library to be loaded and this doesn't usually happen until \
*after* the bundle is loaded, it makes things
simpler if we use `require 'mocha/setup'` to explicitly setup Mocha when we know \
the test library has been loaded. Fixes #146 & #155.
* Consider stubs on superclasses if none exist on primary receiver. Largely \
based on changes suggested by @ccutrer in #145.
Note: this may break existing tests which rely on the old behaviour. Stubbing a \
superclass method and then invoking that
method on a child class would previously cause an unexpected invocation error. \
By searching up through the inheritance
hierarchy for each of the delegate mock objects, we can provide more intuitive \
behaviour. Instead of an unexpected invocation
error, invoking the method on the child class will cause the stubbed method on \
the superclass to be used.
* Avoid recursion when constructing unexpected invocation message. Fixes #168.
* Add explanation of method dispatch. Heavily based on the relevant jMock v1 \
documentation. Fixes #172.
* Make class_eval line number more accurate. This sets the line number as the \
line number of the `def` statement. Closes #169.
* Allow nesting of `responds_with` parameter matcher. Closes #166.
* Define `Mocha` module before it's referenced. The test helper defines a class \
`TestCase` within the `Mocha` module. When
running the tests inside the bundle, the `Mocha` module happens to be defined at \
this point. However when running the tests outside the bundle, it is not defined \
and so an exception is raised: `uninitialized constant Mocha (NameError)`. Fixes \
* Document lack of thread-safety. Fixes #154.
* Document how to use the build-matrix script. Fixes #160.
* Stubbing non-public method should use same visibility. This will probably \
break some existing tests that were somehow relying
on the stubbed method being public while the original method was protected or \
private. Fixes #150.
### Internal changes
* Use lastest Rubygems in Travis CI builds.
* Run the standard test suite against Ruby 2.1.0 in the build matrix.
* Run integration tests against Ruby 2.0.0 with latest Test::Unit gem in the \
* Test::Unit is not available in Ruby v1.9.3 standard library, so remove it from \
the build matrix.
* Force use of Test::Unit runner, etc in relevant integration tests. Prior to \
this, I don't think we were really testing the
Mocha integration with Test::Unit much, because, although `TestUnitTest` was a \
subclass of `Test::Unit::TestCase`, the
important test case instances are the temporary ones built by \
`TestRunner#run_as_test` et al. Prior to this change, these
would only have used Test::Unit where MiniTest was not available *at all* i.e. \
only in early versions of Ruby and when the
MiniTest gem was not loaded.
* Reset environment variables between build matrix builds.
* Only activate integration with relevant test library for each of the \
* Include standard build combinations from Travis CI config i.e. builds using \
standard library versions of test libraries.
* Fix `build-matrix.rb` script. Also use `.travis.yml` to decide what \
combinations to run. This means we
can now simulate the Travis CI build locally and avoid duplication. Fixes #157.
* Remove Ruby version map from build matrix script. I'm using the \
`rbenv-aliases` plugin to alias minor versions to the
relevant patch version.
| 2013-06-16 18:17:41 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to 0.14.0.
* Official support for MiniTest v5. All tests now pass on the continuous
* Add speculative support for Minitest v5. Due to incompatibilities it has not
yet been possible to run the Mocha test suite against Minitest v5. However,
@zenspider (author of Minitest) provided the patch and he has tested it
against Rails v4. Fixes #156. Thanks to @zenspider.
* Documentation updates.
| 2013-03-11 08:37:10 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to to 0.13.3.
# Release Notes
* Allow `Mocha::ParameterMatchers#includes` to accept multiple items. Thanks
* Allow stubbing of *private* `Kernel` methods. Fixes #134. Thanks to @camski
* Avoid a warning when `test/unit/version` is required by other libraries in
the same project. Fixes #140. Thanks to @tmiller.
* Make auto-activation of Test::Unit integration more resilient. This change
is specifically to cope with the nasty re-defining of classes that is done
by the `minitest-spec-rails` gem. Fixes #143. Thanks to @tubaxenor for
* Safer restoration of stubbed method visibility. Fixes #141. Thanks to @tmm1.
* Ensure `Mockery` instance gets reset even if exception raised. Fixes #144.
* Adapt Mocha acceptance tests to cope with changes in output from latest
(v4.6.2) of MiniTest.
* Updates to README about Rails compatibility.
| 2013-02-11 03:54:19 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to 0.13.2.
# Release Notes
* Stubbing of methods re-declared with different visibilty. Fixes #109.
* Add `Mock#responds_like_instance_of`. Fixes #119.
* Make `Expectation#inspect` less verbose and more useful. Fixes #122.
* Make unit tests more robust to changes in environment. Fixes #121.
* Update README in an attempt to head Rails-related issues off at the pass.
* Add a Gem Badge to provide a link to Mocha on Rubygems.
* Make documentation example consistent with other examples.
| 2012-12-16 17:28:07 by Takahiro Kambe | Files touched by this commit (3) | |
Update ruby-mocha to 0.13.1.
* Fix #97 - `Mocha::ParameterMatchers#has_entry` does not work with an Array as \
the entry's value. Thanks to @ngokli.
* Allow deprecation `:debug` mode to be switched on from `MOCHA_OPTIONS` \
* Major overhaul of MiniTest & Test::Unit integration. Mocha now integrates \
with later versions of the two test libraries using documented hooks rather than \
monkey-patching. This should mean that Mocha will integrate with new versions of \
either library without the need to release a new version of Mocha each time, \
which was clearly bad and unsustainable. Many thanks to @tenderlove, @zenspider \
& @kou for their help, suggestions & patience.
* Temporarily deprecated `require 'mocha'`. Use `require 'mocha/setup'` instead. \
The plan is that eventually `require 'mocha'` will *not* automatically integrate \
with either of the two test libraries as it does at the moment, and you'll need \
to explicitly & separately trigger the integration. I think this will \
provide a lot more flexibility and will hopefully do away with the need for the \
`require: false` option in the `Gemfile` which has always confused people.
* Deprecated `require 'mocha_standalone'` and `require 'mocha/standalone'`. Use \
`require 'mocha/api` instead.
* Although these are not part of Mocha's public API, I thought I should mention \
that the MiniTest and Test::Unit assertion counter classes have been combined \
into a single class `Mocha::Integration::AssertionCounter`.
* Extracted Mocha::Hooks module from Mocha::API and added documentation for test \
* Improvements to documentation. Much of it has been combined into the README file.
* Fix #101 - Mock#respond_to? doesn't work with a string argument - thanks to \
* Fix #105 - Travis link in README - thanks to @cknadler.
* Various improvements to automated testing of integration with test libraries.
* Make deprecation warnings more prominent.
* Officially support minitest v4.1.0 (still monkey-patching).
* Fixes #103.
* Officially support minitest v3.5.0 (still monkey-patching).