3.0.0.beta1 / 2013-11-07
Breaking Changes for 3.0.0:
- Raise an explicit error if
should_not_receive(...).and_return
is 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_times
sinceshould_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
with
are always used as implementation. (Xavier Shay) - The config option (added in 2.99) to yield the receiver to
any_instance
implementation blocks now defaults to "on". (Sam Phippen)
Enhancements:
- Allow the
have_received
matcher to use a block to set further expectations
on arguments. (Tim Cowlishaw) - Provide
instance_double
andclass_double
to create verifying doubles,
ported fromrspec-fire
. (Xavier Shay) as_null_object
on a verifying double only responds to defined methods.
(Xavier Shay)- Provide
object_double
to create verified doubles of specific object
instances. (Xavier Shay) - Provide 'verify_partial_doubles
configuration that provides
object_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_constants
option 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_of
orexpect_any_instance_of
instead. (Sam Phippen)instance_double
andclass_double
raiseArgumentError
if 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
:should
syntax 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_original
to handle a complex edge case involving
singleton class ancestors. (Marc-André Lafortune, Myron Marston) - When generating an error message for unexpected arguments,
use#inspect
rather than#description
if#description
returnsnil
or''
so that you still get a useful message.
(Nick DeLuca)