RSpec / RSpec Mocks / Docs
2.13.1 / 2013-04-06
2.13.1 / 2013-04-06
Bug fixes
- Allow a block implementation to be used in combination with
and_yield,and_raise,and_returnorand_throw(Myron Marston).
2.13.0 / 2013-02-23
Bug fixes
- Fix bug that caused weird behavior when a method that had previously been stubbed with multiple return values (e.g.
obj.stub(:foo).and_return(1, 2)) was later mocked with a single return value (e.g.obj.should_receive(:foo).once.and_return(1)). (Myron Marston) - Fix bug related to a mock expectation for a method that already had multiple stubs with different
withconstraints. Previously, the first stub was used, even though it may not have matched the passed args. The fix defers this decision until the message is received so that the proper stub response can be chosen based on the passed arguments (Myron Marston). - Do not call
nil?extra times on a mocked object, in casenil?itself is expected a set number of times (Myron Marston). - Fix
missing_default_stub_errormessage so array args are handled properly (Myron Marston). - Explicitly disallow
any_instance.unstub!(Ryan Jones). - Fix
any_instancestubbing so that it works withDelegatorsubclasses (Myron Marston). - Fix
and_call_originalso that it works withDelegatorsubclasses (Myron Marston). - Fix
any_instance.should_not_receivewhenany_instance.should_receiveis used on the same class in the same example. Previously it would wrongly report a failure even when the message was not received (Myron Marston).
2.12.2 / 2013-01-27
Bug fixes
- Fix
and_call_originalto work properly for methods defined on a module extended onto an object instance (Myron Marston). - Fix
stub_constwith an undefined constnat name to work properly with constant strings that are prefixed with::-- and edge case I missed in the bug fix in the 2.12.1 release (Myron Marston). - Ensure method visibility on a partial mock is restored after reseting method stubs, even on a singleton module (created via
extend self) when the method visibility differs between the instance and singleton versions (Andy Lindeman).
2.12.1 / 2012-12-21
Bug fixes
- Fix
any_instanceto supportand_call_original. (Myron Marston) - Properly restore stubbed aliased methods on rubies that report the incorrect owner (Myron Marston and Andy Lindeman).
- Fix
hide_constandstub_constwith a defined constnat name to work properly with constant strings that are prefixed with::(Myron Marston).
2.12.0 / 2012-11-12
Enhancements
and_raisecan accept an exception class and message, more closely matchingKernel#raise(e.g.,foo.stub(:bar).and_raise(RuntimeError, "message")) (Bas Vodde)- Add
and_call_original, which will delegate the message to the original method (Myron Marston).
Deprecations:
- Add deprecation warning when using
and_returnwithshould_not_receive(Neha Kumari)
2.11.3 / 2012-09-19
Bug fixes
- Fix
:transfer_nested_constantsoption ofstub_constso that it doesn't blow up when there are inherited constants. (Myron Marston) any_instancestubs can be used on classes that overrideObject#method. (Andy Lindeman)- Methods stubbed with
any_instanceare unstubbed after the test finishes. (Andy Lindeman) - Fix confusing error message when calling a mocked class method an extra time with the wrong arguments (Myron Marston).
2.11.2 / 2012-08-11
Bug fixes
- Don't modify
dupon classes that don't supportdup(David Chelimsky) - Fix
any_instanceso that it works properly with methods defined on a superclass. (Daniel Eguzkiza) - Fix
stub_constso that it works properly for nested constants that share a name with a top-level constant (e.g. "MyGem::Hash"). (Myron Marston)
2.11.1 / 2012-07-09
Bug fixes
- Fix
should_receiveso that when it is called on anas_null_objectdouble with no implementation, and there is a previous explicit stub for the same method, the explicit stub remains (rather than being overriden with the null object implementation--return self). (Myron Marston)
2.11.0 / 2012-07-07
Enhancements
- Expose ArgumentListMatcher as a formal API * supports use by 3rd party mock frameworks like Surrogate
- Add
stub_constAPI to stub constants for the duration of an example (Myron Marston).
Bug fixes
- Fix regression of edge case behavior.
double.should_receive(:foo) { a }was causing a NoMethodError whendouble.stub(:foo).and_return(a, b)had been setup before (Myron Marston). - Infinite loop generated by using
any_instanceanddup. (Sidu Ponnappa @kaiwren) double.should_receive(:foo).at_least(:once).and_return(a)always returns a even if:foois already stubbed.- Prevent infinite loop when interpolating a null double into a string as an integer (
"%i" % double.as_null_object). (Myron Marston) - Fix
should_receiveso that null object behavior (e.g. returning self) is preserved if no implementation is given (Myron Marston). - Fix
and_raiseso that it raisesRuntimeErrorrather thanExceptionby default, just like ruby does. (Andrew Marshall)
2.10.1 / 2012-05-05
Bug fixes
- fix regression of edge case behavior (https://github.com/rspec/rspec-mocks/issues/132) * fixed failure of
object.should_receive(:message).at_least(0).times.and_return value* fixed failure ofobject.should_not_receive(:message).and_return value
2.10.0 / 2012-05-03
Bug fixes
- fail fast when an
exactlyorat_mostexpectation is exceeded
2.9.0 / 2012-03-17
Enhancements
- Support order constraints across objects (preethiramdev)
Bug fixes
- Allow a
as_null_objectto be passed towith - Pass proc to block passed to stub (Aubrey Rhodes)
- Initialize child message expectation args to match any args (#109 - preethiramdev)
2.8.0 / 2012-01-04
No changes for this release. Just releasing with the other rspec gems.
2.8.0.rc2 / 2011-12-19
No changes for this release. Just releasing with the other rspec gems.
2.8.0.rc1 / 2011-11-06
Enhancements
- Eliminate Ruby warnings (Matijs van Zuijlen)
2.7.0 / 2011-10-16
Enhancements
- Use
__send__rather thansend(alextk) - Add support for
any_instance.stub_chain(Sidu Ponnappa) - Add support for
any_instanceargument matching based onwith(Sidu Ponnappa and Andy Lindeman)
Changes
- Check for
failure_message_for_shouldorfailure_messageinstead ofdescriptionto detect a matcher (Tibor Claassen)
Bug fixes
- pass a hash to
any_instance.stub. (Justin Ko) - allow
to_aryto be called without raisingNoMethodError(Mikhail Dieterle) any_instanceproperly restores private methods (Sidu Ponnappa)
2.6.0 / 2011-05-12
Enhancements
- Add support for
any_instance.stubandany_instance.should_receive(Sidu Ponnappa and Andy Lindeman)
Bug fixes
- fix bug in which multiple chains with shared messages ending in hashes failed to return the correct value
2.5.0 / 2011-02-05
Bug fixes
- message expectation counts now work in combination with a stub (Damian Nurzynski)
- fix failure message when message received with incorrect args (Josep M. Bach)
2.4.0 / 2011-01-02
No functional changes in this release, which was made to align with the rspec-core-2.4.0 release.
2.3.0 / 2010-12-12
Bug fixes
- Fix our Marshal extension so that it does not interfere with objects that have their own
@mock_proxyinstance variable. (Myron Marston)
2.2.0 / 2010-11-28
Enhancements
- Added "rspec/mocks/standalone" for exploring the rspec-mocks in irb.
Bug fix
- Eliminate warning on splat args without parens (Gioele Barabucci)
- Fix bug where
obj.should_receive(:foo).with(stub.as_null_object)would pass with a false positive.
2.1.0 / 2010-11-07
Bug fixes
- Fix serialization of stubbed object (Josep M Bach)
2.0.0 / 2010-10-10
2.0.0.rc / 2010-10-05
Enhancements
- support passing a block to an expectation block (Nicolas Braem) *
obj.should_receive(:msg) {|&block| ... }
Bug fixes
- Fix YAML serialization of stub (Myron Marston)
- Fix rdoc rake task (Hans de Graaff)
2.0.0.beta.22 / 2010-09-12
Bug fixes
- fixed regression that broke
obj.stub_chain(:a, :b => :c) - fixed regression that broke
obj.stub_chain(:a, :b) { :c } respond_to?always returns true when usingas_null_object
Source: features/Changelog.md at v2.13.1, RSpec Mocks (MIT license).