Recent Releases of https://github.com/rspec/rspec-mocks
https://github.com/rspec/rspec-mocks -
2.14.6 / 2014-02-20
Bug Fixes:
- Ensure
any_instancemethod stubs and expectations are torn down regardless of
expectation failures. (Sam Phippen)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-mocks - 2.99.0.beta2
2.99.0.beta2 / 2014-02-17
Deprecations:
- Deprecate
RSpec::Mocks::Mockin favor ofRSpec::Mocks::Double.
(Myron Marston) - Deprecate the
hostargument ofRSpec::Mocks.setup. Instead
RSpec::Mocks::ExampleMethodsshould be included directly in the scope where
RSpec's mocking capabilities are used. (Sam Phippen) - Deprecate using any of rspec-mocks' features outside the per-test
lifecycle (e.g. from abefore(:all)hook). (Myron Marston) - Deprecate re-using a test double in another example. (Myron Marston)
- Deprecate
and_return { value }andand_returnwithout arguments. (Yuji Nakayama)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-mocks - 3.0.0.beta2
3.0.0.beta2 / 2014-02-17
Breaking Changes for 3.0.0:
- Rename
RSpec::Mocks::MocktoRSpec::Mocks::Double. (Myron Marston) - Change how to integrate rspec-mocks in other test frameworks. You now
need to includeRSpec::Mocks::ExampleMethodsin your test context.
(Myron Marston) - Prevent RSpec mocks' doubles and partial doubles from being used outside of
the per-test lifecycle (e.g. from abefore(:all)hook). (Sam Phippen) - Remove the
hostargument ofRSpec::Mocks.setup. Instead
RSpec::Mocks::ExampleMethodsshould be included directly in the scope where
RSpec's mocking capabilities are used. (Sam Phippen) - Make test doubles raise errors if you attempt to use them after they
get reset, to help surface issues when you accidentally retain
references to test doubles and attempt to reuse them in another
example. (Myron Marston) - Remove support for
and_return { value }andand_returnwithout arguments. (Yuji Nakayama)
Enhancements:
- Add
receive_message_chainwhich provides the functionality of the old
stub_chainfor the new allow/expect syntax. Use it like so:allow(...).to receive_message_chain(:foo, :bar, :bazz). (Sam Phippen). - Change argument matchers to use
===as their primary matching
protocol, since their semantics mirror that of a case or rescue statement
(which uses===for matching). (Myron Marston) - Add
RSpec::Mocks.with_temporary_scope, which allows you to create
temporary rspec-mocks scopes in arbitrary places (such as a
before(:all)hook). (Myron Marston) - Support keyword arguments when checking arity with verifying doubles.
(Xavier Shay)
Bug Fixes:
- Fix regression in 3.0.0.beta1 that caused
double("string_name" => :value)
to stop working. (Xavier Shay) - Fix the way rspec-mocks and rspec-core interact so that if users
define aletwith the same name as one of the methods
fromRSpec::Mocks::ArgumentMatchers, the user'slettakes
precedence. (Michi Huber, Myron Marston) - Fix verified doubles so that their methods match the visibility
(public, protected or private) of the interface they verify
against. (Myron Marston) - Fix verified null object doubles so that they do not wrongly
report that they respond to anything. They only respond to methods
available on the interface they verify against. (Myron Marston) - Fix deprecation warning for use of old
:shouldsyntax w/o explicit
config so that it no longer is silenced by an extension gem such
as rspec-rails when it callsconfig.add_stub_and_should_receive_to.
(Sam Phippen) - Fix
expectsyntax so that it does not wrongly emit a "You're
overriding a previous implementation for this stub" warning when
you are not actually doing that. (Myron Marston) - Fix
any_instance.unstubwhen used on sub classes for whom the super
class has hadany_instance.stubinvoked on. (Jon Rowe) - Fix regression in
stub_chain/receive_message_chainthat caused
it to raise anArgumentErrorwhen passing args to the stubbed
methods. (Sam Phippen) - Correct stub of undefined parent modules all the way down when stubbing a
nested constant. (Xavier Shay) - Raise
VerifyingDoubleNotDefinedErrorwhen a constant is not defined for
a verifying class double. (Maurício Linhares) - Remove
Double#to_str, which caused confusingraise some_double
behavior. (Maurício Linhares)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-mocks - 2.14.5
2.14.5 / 2014-02-01
Bug Fixes:
- Fix regression that caused block implementations to not receive all
args on 1.8.7 if the block also receives a block, due to Proc#arity
reporting1no matter how many args the block receives if it
receives a block, too. (Myron Marston)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-mocks - 3.0.0.beta1
3.0.0.beta1 / 2013-11-07
Breaking Changes for 3.0.0:
- Raise an explicit error if
should_not_receive(...).and_returnis used. (Sam
Phippen) - Remove 1.8.6 workarounds. (Jon Rowe)
- Remove
stub!andunstub!. (Sam Phippen) - Remove
mock(name, methods)andstub(name, methods), leaving
double(name, methods)for creating test doubles. (Sam Phippen, Michi Huber) - Remove
any_number_of_timessinceshould_receive(:msg).any_number_of_times
is really a stub in a mock's clothing. (Sam Phippen) - Remove support for re-using the same null-object test double in multiple
examples. Test doubles are designed to only live for one example.
(Myron Marston) - Make
at_least(0)raise an error. (Sam Phippen) - Remove support for
require 'spec/mocks'which had been kept
in place for backwards compatibility with RSpec 1. (Myron Marston) - Blocks provided to
withare always used as implementation. (Xavier Shay) - The config option (added in 2.99) to yield the receiver to
any_instanceimplementation blocks now defaults to "on". (Sam Phippen)
Enhancements:
- Allow the
have_receivedmatcher to use a block to set further expectations
on arguments. (Tim Cowlishaw) - Provide
instance_doubleandclass_doubleto create verifying doubles,
ported fromrspec-fire. (Xavier Shay) as_null_objecton a verifying double only responds to defined methods.
(Xavier Shay)- Provide
object_doubleto create verified doubles of specific object
instances. (Xavier Shay) - Provide 'verify_partial_doubles
configuration that providesobject_double`
like verification behaviour on partial mocks. (Xavier Shay) - Improved performance of double creation, particularly those with many
attributes. (Xavier Shay) - Default value of
transfer_nested_constantsoption for constant stubbing can
be configured. (Xavier Shay) - Messages can be allowed or expected on in bulk via
receive_messages(:message => :value). (Jon Rowe) allow(Klass.any_instance)andexpect(Klass.any_instance)now print a
warning. This is usually a mistake, and users usually want
allow_any_instance_oforexpect_any_instance_ofinstead. (Sam Phippen)instance_doubleandclass_doubleraiseArgumentErrorif the underlying
module is loaded and the arity of the method being invoked does not match the
arity of the method as it is actually implemented. (Andy Lindeman)- Spies can now check their invocation ordering is correct. (Jon Rowe)
Deprecations:
- Using the old
:shouldsyntax without explicitly configuring it
is disabled. It will continue to work but will emit a deprecation
warning in RSpec 3 if you do not explicitly enable it. (Sam Phippen)
Bug Fixes:
- Fix
and_call_originalto handle a complex edge case involving
singleton class ancestors. (Marc-André Lafortune, Myron Marston) - When generating an error message for unexpected arguments,
use#inspectrather than#descriptionif#description
returnsnilor''so that you still get a useful message.
(Nick DeLuca)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks - 2.99.0.beta1
2.99.0.beta1 / 2013-11-07
Deprecations
- Expecting to use lambdas or other strong arity implementations for stub
methods with mis-matched arity is deprecated and support for them will be
removed in 3.0. Either provide the right amount of arguments or use a weak
arity implementation (methods with splats or procs). (Jon Rowe) - Using the same test double instance in multiple examples is deprecated. Test
doubles are only meant to live for one example. The mocks and stubs have
always been reset between examples; however, in 2.x theas_null_object
state was not reset and some users relied on this to have a null object
double that is used for many examples. This behavior will be removed in 3.0.
(Myron Marston) - Print a detailed warning when an
any_instanceimplementation block is used
when the newyield_receiver_to_any_instance_implementation_blocksconfig
option is not explicitly set, as RSpec 3.0 will default to enabling this new
feature. (Sam Phippen)
Enhancements:
- Add a config option to yield the receiver to
any_instanceimplementation
blocks. (Sam Phippen)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks - 2.14.4
2.14.4 / 2013-10-15
Bug Fixes:
- Fix issue where unstubing methods on "any instances" would not
remove stubs on existing instances (Jon Rowe) - Fix issue with receive(:message) do ... end precedence preventing
the usage of modifications (and_returnetc) (Jon Rowe)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks - 2.14.3
2.14.3 / 2013-08-08
Bug Fixes:
- Fix stubbing some instance methods for classes whose hierarchy includes
a prepended Module (Bradley Schaefer)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks - 2.14.2
2.14.2 / 2013-07-30
Bug Fixes:
- Fix
as_null_objectdoubles so that they returnnilfromto_ary
(Jon Rowe). - Fix regression in 2.14 that made
stub!(with an implicit receiver)
return a test double rather than stub a method (Myron Marston).
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks -
2.14.1 / 2013-07-07
Bug Fixes:
- Restore
double.as_null_objectbehavior from 2.13 and earlier: a
double's nullness persisted between examples in earlier examples.
While this is not an intended use case (test doubles are meant to live
for only one example), we don't want to break behavior users rely
on in a minor relase. This will be deprecated in 2.99 and removed
in 3.0. (Myron Marston)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-mocks - 2.14.0
2.14.0 / 2013-07-06
Enhancements:
- Document test spies in the readme. (Adarsh Pandit)
- Add an
array_includingmatcher. (Sam Phippen) - Add a syntax-agnostic API for mocking or stubbing a method. This is
intended for use by libraries such as rspec-rails that need to mock
or stub a method, and work regardless of the syntax the user has
configured (Paul Annesley, Myron Marston and Sam Phippen).
Bug Fixes:
- Fix
doubleso that it sets up passed stubs correctly regardless of
the configured syntax (Paul Annesley). - Allow a block implementation to be used in combination with
and_yield,and_raise,and_returnorand_throw. This got fixed
in 2.13.1 but failed to get merged into master for the 2.14.0.rc1
release (Myron Marston). Marshal.dumpdoes not unnecessarily duplicate objects when rspec-mocks has
not been fully initialized. This could cause errors when usingsporkor
similar preloading gems (Andy Lindeman).
2.14.0.rc1 / 2013-05-27
Enhancements:
- Refactor internals so that the mock proxy methods and state are held
outside of the mocked object rather than inside it. This paves the way
for future syntax enhancements and removes the need for some hacky
work arounds forany_instancedup'ing andYAMLserialization,
among other things. Note that the code now relies upon__id__
returning a unique, consistent value for any object you want to
mock or stub (Myron Marston). - Add support for test spies. This allows you to verify a message
was received afterwards using thehave_receivedmatcher.
Note that you must first stub the method or use a null double.
(Joe Ferris and Joël Quenneville) - Make
at_leastandat_moststyle receive expectations print that they were
expecting at least or at most some number of calls, rather than just the
number of calls given in the expectation (Sam Phippen) - Make
withstyle receive expectations print the args they were expecting, and
the args that they got (Sam Phippen) - Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).
- Add a new
:expectsyntax for message expectations
(Myron Marston and Sam Phippen).
Bug fixes
- Fix
any_instanceso that a frozen object can bedup'd when methods
have been stubbed on that type usingany_instance(Jon Rowe). - Fix
and_call_originalso that it properly raises anArgumentError
when the wrong number of args are passed (Jon Rowe). - Fix
doubleon 1.9.2 so you can wrap them in an Array
usingArray(my_double)(Jon Rowe). - Fix
stub_constandhide_constto handle constants that redefinesend
(Sam Phippen). - Fix
Marshal.dumpextension so that it correctly handles nil.
(Luke Imhoff, Jon Rowe) - Fix isolation of
allow_message_expectations_on_nil(Jon Rowe) - Use inspect to format actual arguments on expectations in failure messages (#280, Ben Langfeld)
- Protect against improperly initialised test doubles (#293) (Joseph Shraibman and Jon Rowe)
Deprecations
- Deprecate
stubandmockas aliases fordouble.doubleis the
best term for creating a test double, and it reduces confusion to
have only one term (Michi Huber). - Deprecate
stub!andunstub!in favor ofstubandunstub
(Jon Rowe). - Deprecate
at_least(0).timesandany_number_of_times(Michi Huber).
- Ruby
Published by myronmarston over 12 years ago