3.0.0.beta2 / 2014-02-17
Breaking Changes for 3.0.0:
- Rename
RSpec::Mocks::Mock
toRSpec::Mocks::Double
. (Myron Marston) - Change how to integrate rspec-mocks in other test frameworks. You now
need to includeRSpec::Mocks::ExampleMethods
in 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
host
argument ofRSpec::Mocks.setup
. Instead
RSpec::Mocks::ExampleMethods
should 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_return
without arguments. (Yuji Nakayama)
Enhancements:
- Add
receive_message_chain
which provides the functionality of the old
stub_chain
for 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 alet
with the same name as one of the methods
fromRSpec::Mocks::ArgumentMatchers
, the user'slet
takes
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
:should
syntax 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
expect
syntax 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.unstub
when used on sub classes for whom the super
class has hadany_instance.stub
invoked on. (Jon Rowe) - Fix regression in
stub_chain
/receive_message_chain
that caused
it to raise anArgumentError
when 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
VerifyingDoubleNotDefinedError
when 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)