3.0.0.beta2
Pre-release
Pre-release
myronmarston
released this
18 Feb 06:45
·
2603 commits
to main
since this release
3.0.0.beta2 / 2014-02-17
Breaking Changes for 3.0.0:
- Make
mock_with
option more strict. Strings are no longer supported
(e.g.mock_with "mocha"
) -- use a symbol instead. Also, unrecognized
values will now result in an error rather than falling back to the
null mocking adapter. If you want to use the null mocking adapter,
usemock_with :nothing
(as has been documented for a long time).
(Myron Marston) - Remove support for overriding RSpec's built-in
:if
and:unless
filters. (Ashish Dixit) - Custom formatters are now required to call
RSpec::Core::Formatters.register(formatter_class, *notifications)
wherenotifications
is the list of events the formatter wishes to
be notified about. Notifications are handled by methods matching the
names on formatters. This allows us to add or remove notifications
without breaking existing formatters. (Jon Rowe) - Change arguments passed to formatters. Rather than passing multiple
arguments (which limits are ability to add additional arguments as
doing so would break existing formatters), we now pass a notification
value object that exposes the same data via attributes. This will
allow us to add new bits of data to a notification event without
breaking existing formattesr. (Jon Rowe) - Remove support for deprecated
:alias
option for
RSpec.configuration.add_setting
. (Myron Marston) - Remove support for deprecated
RSpec.configuration.requires = [...]
.
(Myron Marston) - Remove support for deprecated
--formatter
CLI option. (Myron Marston) - Remove support for deprecated
--configure
CLI option. (Myron Marston) - Remove support for deprecated
RSpec::Core::RakeTask#spec_opts=
.
(Myron Marston) - An example group level
pending
block or:pending
metadata now executes
the example and cause a failure if it passes, otherwise it will be pending if
it fails. The old "never run" behaviour is still used forxexample
,xit
,
andxspecify
, or via a newskip
method or:skip
metadata option.
(Xavier Shay) - After calling
pending
inside an example, the remainder of the example will
now be run. If it passes a failure is raised, otherwise the example is marked
pending. The old "never run" behaviour is provided a by a newskip
method.
(Xavier Shay) - Pending blocks inside an example have been removed as a feature with no
direct replacement. Useskip
orpending
without a block. (Xavier Shay) - Pending statement is no longer allowed in
before(:all)
hooks. Useskip
instead. (Xavier Shay) - Remove
show_failures_in_pending_blocks
configuration option. (Xavier Shay) - Remove support for specifying the documentation formatter using
's', 'n', 'spec' or 'nested'. (Jon Rowe)
Enhancements:
- Add
is_expected
for one-liners that read well with the
expect
-based syntax.is_expected
is simply defined as
expect(subject)
and can be used in an expression like:
it { is_expected.to read_well }
. (Myron Marston) - Add example run time to JSON formatter output. (Karthik Kastury)
- Add more suggested settings to the files generated by
rspec --init
. (Myron Marston) - Add
config.alias_example_group_to
, which can be used to define a
new method that defines an example group with the provided metadata.
(Michi Huber) - Add
xdescribe
andxcontext
as shortcuts to make an example group
pending. (Myron Marston) - Add
fdescribe
andfcontext
as shortcuts to focus an example group.
(Myron Marston) - Don't autorun specs via
#at_exit
by default.require 'rspec/autorun'
is only needed when running specs viaruby
, as it always has been.
Running specs viarake
orrspec
are both unaffected. (Ben Hoskings) - Add
expose_dsl_globally
config option, defaulting to true. When disabled
it will remove the monkey patches rspec-core adds tomain
andModule
(e.g.describe
,shared_examples_for
, etc). (Jon Rowe) - Expose RSpec DSL entry point methods (
describe
,
shared_examples_for
, etc) on theRSpec
constant. Intended for use
whenexpose_dsl_globally
is set tofalse
. (Jon Rowe) - For consistency, expose all example group aliases (including
context
) on theRSpec
constant. Ifexpose_dsl_globally
is set to
true
, also expose them onmain
andModule
. Historically, onlydescribe
was exposed. (Jon Rowe, Michi Huber)
Bug Fixes:
- Fix failure (undefined method
path
) in end-of-run summary
whenraise_errors_for_deprecations!
is configured. (Myron Marston) - Issue error when attempting to use -i or --I on command line,
too close to -I to be considered short hand for --init. (Jon Rowe) - Prevent adding formatters to an output target if the same
formatter has already been added to that output. (Alex Peattie) - Allow a matcher-generated example description to be used when
the example is pending. (Myron Marston) - Ensure the configured
failure_exit_code
is used by the rake
task when there is a failure. (Jon Rowe) - Restore behaviour whereby system exclusion filters take priority over working
directory (was broken in beta1). (Jon Rowe) - Prevent RSpec mangling file names that have substrings containing
line_number
ordefault_path
. (Matijs van Zuijlen)