RSpec / RSpec Core / Docs
2.99.2 / 2014-08-19
2.99.2 / 2014-08-19
Enhancements:
- Improve deprecation warning for RSpec 3 change in
describe <a symbol>behavior. (Jon Rowe, #1667)
2.99.1 / 2014-06-19
Bug Fixes:
- Add missing deprecation warning for when
RSpec::Core::Runneris used multiple times in the same process. In 2.x RSpec's global state was automatically cleared between runs but in 3.0 you need to callRSpec.resetmanually in these situations. (Sam Phippen, #1587) - Prevent deprecation being accidentally issues when doubles used with
be_matchers due to automatically generated descriptions. (Jon Rowe, #1573) - Load
rspec/corewhen loadingrspec/core/rake_taskto ensure we can issue deprecations correctly. (Jon Rowe, #1612)
2.99.0 / 2014-06-01
Bug Fixes:
- Fix
BaseTextFormatterso that it does not re-close a closed output stream. (Myron Marston) - Use
RSpec::Configuration#backtrace_exclusion_patternsrather than the deprecatedRSpec::Configuration#backtrace_clean_patternswhen mocking with rr. (David Dollar)
2.99.0.rc1 / 2014-05-18
Enhancements:
- Add
--deprecation-outCLI option which directs deprecation warnings to the named file. (Myron Marston) - Backport support for
skipin metadata to skip execution of an example. (Xavier Shay, #1472) - Add
Pathnamesupport for setting all output streams. (Aaron Kromer) - Add
test_unitandminitestexpectation frameworks. (Aaron Kromer)
Deprecations:
- Deprecate
RSpec::Core::Pending::PendingDeclaredInExample, useSkipDeclaredInExampleinstead. (Xavier Shay) - Issue a deprecation when
described_classis accessed from within a nesteddescribe <SomeClass>example group, sincedescribed_classwill return the innermost described class in RSpec 3 rather than the outermost described class, as it behaved in RSpec 2. (Myron Marston) - Deprecate
RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS,RSpec::Core::FilterManager::STANDALONE_FILTERSand use of#empty_without_conditional_filters?on those filters. (Sergey Pchelincev) - Deprecate
RSpec::Core::Example#optionsin favor ofRSpec::Core::Example#metadata. (Myron Marston) - Issue warning when passing a symbol or hash to
describeorcontextas the first argument. In RSpec 2.x this would be treated as metadata but in RSpec 3 it'll be treated as the described object. To continue having it treated as metadata, pass a description before the symbol or hash. (Myron Marston) - Deprecate
RSpec::Core::BaseTextFormatter::VT100_COLORSandRSpec::Core::BaseTextFormatter::VT100_COLOR_CODESin favour ofRSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODESandRSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODE_VALUES. (Jon Rowe) - Deprecate
RSpec::Core::ExampleGroup.display_namein favor ofRSpec::Core::ExampleGroup.description. (Myron Marston) - Deprecate
RSpec::Core::ExampleGroup.describesin favor ofRSpec::Core::ExampleGroup.described_class. (Myron Marston) - Deprecate
RSpec::Core::ExampleGroup.alias_example_toin favor ofRSpec::Core::Configuration#alias_example_to. (Myron Marston) - Deprecate
RSpec::Core::ExampleGroup.alias_it_behaves_like_toin favor ofRSpec::Core::Configuration#alias_it_behaves_like_to. (Myron Marston) - Deprecate
RSpec::Core::ExampleGroup.focusedin favor ofRSpec::Core::ExampleGroup.focus. (Myron Marston) - Add deprecation warning for
config.filter_run :focusedsince example aliasesfitandfocuswill no longer include:focusedmetadata but will continue to include:focus. (Myron Marston) - Deprecate filtering by
:line_number(e.g.--line-numberfrom the CLI). Use location filtering instead. (Myron Marston) - Deprecate
--default_pathas an alternative to--default-path. (Jon Rowe) - Deprecate
RSpec::Core::Configuration#warningsin favor ofRSpec::Core::Configuration#warnings?. (Myron Marston) - Deprecate
share_examples_forin favor ofshared_examples_foror justshared_examples. (Myron Marston) - Deprecate
RSpec::Core::CommandLinein favor ofRSpec::Core::Runner. (Myron Marston) - Deprecate
#color_enabled,#color_enabled=and#color?in favour of#color,#color=and#color_enabled? output. (Jon Rowe) - Deprecate
#filename_patternin favour of#pattern. (Jon Rowe) - Deprecate
#backtrace_cleanerin favour of#backtrace_formatter. (Jon Rowe) - Deprecate mutating
RSpec::Configuration#formatters. (Jon Rowe) - Deprecate
stdlibas an available expectation framework in favour oftest_unitandminitest. (Aaron Kromer)
Bug Fixes:
- Issue a warning when you set
config.deprecation_streamtoo late for it to take effect because the reporter has already been setup. (Myron Marston) skipwith a block should not execute the block. (Xavier Shay)
2.99.0.beta2 / 2014-02-17
Enhancements:
- Add
is_expectedfor one-liners that read well with theexpect-based syntax.is_expectedis simply defined asexpect(subject)and can be used in an expression like:it { is_expected.to read_well }. (Myron Marston) - Backport
skipfrom RSpec 3, which acts likependingdid in RSpec 2 when not given a block, since the behavior ofpendingis changing in RSpec 3. (Xavier Shay)
Deprecations:
- Deprecate inexact
mock_withconfig options. RSpec 3 will only support the exact symbols:rspec,:mocha,:flexmock,:rror:nothing(or any module that implements the adapter interface). RSpec 2 did fuzzy matching but this will not be supported going forward. (Myron Marston) - Deprecate
show_failures_in_pending_blocksconfig option. To achieve the same behavior as the option enabled, you can use a custom formatter instead. (Xavier Shay) - Add a deprecation warning for the fact that the behavior of
pendingis changing in RSpec 3 -- rather than skipping the example (as it did in 2.x when no block was provided), it will run the example and mark it as failed if no exception is raised. Useskipinstead to preserve the old behavior. (Xavier Shay) - Deprecate 's', 'n', 'spec' and 'nested' as aliases for documentation formatter. (Jon Rowe)
- Deprecate
RSpec::Core::Reporter#abortin favor ofRSpec::Core::Reporter#finish. (Jon Rowe)
Bug Fixes:
- Fix failure (undefined method
path) in end-of-run summary whenraise_errors_for_deprecations!is configured. (Myron Marston) - Fix issue were overridding spec ordering from the command line wasnt fully recognised interally. (Jon Rowe)
2.99.0.beta1 / 2013-11-07
Enhancements
- Block-based DSL methods that run in the context of an example (
it,before(:each),after(:each),letandsubject) now yield the example as a block argument. (David Chelimsky) - Warn when the name of more than one example group is submitted to
include_examplesand it's aliases. (David Chelimsky) - Add
expose_current_running_example_asconfig option for use during the upgrade process when external gems use the deprecatedRSpec::Core::ExampleGroup#exampleandRSpec::Core::ExampleGroup#running_examplemethods. (Myron Marston) - Limit spamminess of deprecation messages. (Bradley Schaefer, Loren Segal)
- Add
config.raise_errors_for_deprecations!option, which turns deprecations warnings into errors to surface the full backtrace of the call site. (Myron Marston)
Deprecations
- Deprecate
RSpec::Core::ExampleGroup#exampleandRSpec::Core::ExampleGroup#running_examplemethods. If you need access to the example (e.g. to get its metadata), use a block argument instead. (David Chelimsky) - Deprecate use of
autotest/rspec2in favour ofrspec-autotest. (Jon Rowe) - Deprecate RSpec's built-in debugger support. Use a CLI option like
-rruby-debug(for the ruby-debug gem) or-rdebugger(for the debugger gem) instead. (Myron Marston) - Deprecate
RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = false. RSpec 3 will not support having this option set tofalse. (Myron Marston) - Deprecate accessing a
letorsubjectdeclaration in aafter(:all)hook. (Myron Marston, Jon Rowe) - Deprecate built-in
itsusage in favor ofrspec-itsgem due to planned removal in RSpec 3. (Peter Alfvin) - Deprecate
RSpec::Core::PendingExampleFixedErrorin favor ofRSpec::Core::Pending::PendingExampleFixedError. (Myron Marston) - Deprecate
RSpec::Core::Configuration#outandRSpec::Core::Configuration#outputin favor ofRSpec::Core::Configuration#output_stream. (Myron Marston) - Deprecate legacy ordering APIs.
- You should use
register_ordering(:global)instead of these: *RSpec::Core::Configuration#order_examples*RSpec::Core::Configuration#order_groups*RSpec::Core::Configuration#order_groups_and_examples - These are deprecated with no replacement because in RSpec 3 ordering is a property of individual example groups rather than just a global property of the entire test suite: *
RSpec::Core::Configuration#order*RSpec::Core::Configuration#randomize? --order defaultis deprecated in favor of--order defined(Myron Marston)
- You should use
2.14.8 / 2014-02-27
Bug fixes:
- Fix regression with the
textmateformatterthat prevented backtrace links from being clickable. (Stefan Daschek)
2.14.7 / 2013-10-29
Bug fixes:
- Fix regression in 2.14.6 that broke the Fivemat formatter. It depended upon either
example.execution_result[:exception].pending_fixed?(which was removed in 2.14.6 to fix an issue with frozen error objects) orRSpec::Core::PendingExampleFixedError(which was renamed toRSpec::Core::Pending::PendingExampleFixedErrorin 2.8. This fix makes a constant alias for the old error name. (Myron Marston)
2.14.6 / 2013-10-15
Bug fixes:
- Format stringified numbers correctly when mathn library is loaded. (Jay Hayes)
- Fix an issue that prevented the use of frozen error objects. (Lars Gierth)
2.14.5 / 2013-08-13
Bug fixes:
- Fix a
NoMethodErrorthat was being raised when there were no shared examples or contexts declared andRSpec.world.resetis invoked. (thepoho, Jon Rowe, Myron Marston) - Fix a deprecation warning that was being incorrectly displayed when
shared_examplesare declared at top level in amodulescope. (Jon Rowe) - Fix after(:all) hooks so consecutive (same context) scopes will run even if one raises an error. (Jon Rowe, Trejkaz)
- JsonFormatter no longer dies if
dump_profileisn't defined (Alex / @MasterLambaster, Jon Rowe)
2.14.4 / 2013-07-21
Bug fixes
- Fix regression in 2.14: ensure configured requires (via
-roption) are loaded before spec files are loaded. This allows the spec files to programatically change the file pattern (Jon Rowe). - Autoload
RSpec::MocksandRSpec::Expectationswhen referenced if they are not already loaded (RSpec::Matcheshas been autoloaded for a while). In therspecgem, we changed it recently to stop loadingrspec/mocksandrspec/expectationsby default, as some users reported problems where they were intending to use mocha, not rspec-mocks, but rspec-mocks was loaded and causing a conflict. rspec-core loads mocks and expectations at the appropriate time, so it seemed like a safe change -- but caused a problem for some authors of libraries that integrate with RSpec. This fixes that problem. (Myron Marston) - Gracefully handle a command like
rspec --profile path/to/spec.rb: thepath/to/spec.rbarg was being wrongly treated as theprofileinteger arg, which got cast0usingto_i, causing no profiled examples to be printed. (Jon Rowe)
2.14.3 / 2013-07-13
Bug fixes
- Fix deprecation notices issued from
RSpec::Core::RakeTaskso that they work properly when all of rspec-core is not loaded. (This was a regression in 2.14) (Jon Rowe)
2.14.2 / 2013-07-09
Bug fixes
- Fix regression caused by 2.14.1 release: formatters that report that they
respond_to?a notification, but had no corresponding method would raise an error when registered. The new fix is to just implementstarton the deprecation formatter to fix the original JRuby/ruby-debug issue. (Jon Rowe)
2.14.1 / 2013-07-08
Bug fixes
- Address deprecation formatter failure when using
ruby-debugon JRuby: fixRSpec::Core::Reporterto not send a notification when the formatter's implementation of the notification method comes fromKernel(Alex Portnov, Jon Rowe).
2.14.0 / 2013-07-06
Enhancements
- Apply focus to examples defined with
fit(equivalent ofit "description", focus: true) (Michael de Silva)
Bug fix
- Ensure methods defined by
lettake precedence over others when there is a name collision (e.g. from an included module). (Jon Rowe, Andy Lindeman and Myron Marston)
2.14.0.rc1 / 2013-05-27
Enhancements
- Improved Windows detection inside Git Bash, for better
--colorhandling. - Add profiling of the slowest example groups to
--profileoption. The output is sorted by the slowest average example groups. - Don't show slow examples if there's a failure and both
--fail-fastand--profileoptions are used (Paweł Gościcki). - Rather than always adding
specto the load path, add the configured--default-pathto the load path (which defaults tospec). This better supports folks who choose to put their specs in a different directory (John Feminella). - Add some logic to test time duration precision. Make it a function of time, dropping precision as the time increases. (Aaron Kromer)
- Add new
backtrace_inclusion_patternsconfig option. Backtrace lines that match one of these patterns will always be included in the backtrace, even if they match an exclusion pattern, too (Sam Phippen). - Support ERB trim mode using the
-when parsing.rspecas ERB (Gabor Garami). - Give a better error message when let and subject are called without a block. (Sam Phippen).
- List the precedence of
.rspec-localin the configuration documentation (Sam Phippen) - Support
{a,b}shell expansion syntax in--patternoption (Konstantin Haase). - Add cucumber documentation for --require command line option (Bradley Schaefer)
- Expose configuration options via config:
config.libsreturns the libs configured to be added onto the load pathfull_backtrace?returns the state of the backtrace cleanerdebug?returns true when the debugger is loadedline_numbersreturns the line numbers we are filtering by (if any)full_descriptionreturns the RegExp used to filter descriptions (Jon Rowe)
- Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
- Configure ruby's warning behaviour with
--warnings(Jon Rowe) - Fix an obscure issue on old versions of
1.8.7whereTime.dupwouldn't allow access toTime.now(Jon Rowe) - Make
shared_examples_forcontext aware, so that keys may be safely reused in multiple contexts without colliding. (Jon Rowe) - Add a configurable
deprecation_stream(Jon Rowe) - Publish deprecations through a formatter (David Chelimsky)
Bug fixes
- Make JSON formatter behave the same when it comes to
--profileas the text formatter (Paweł Gościcki). - Fix named subjects so that if an inner group defines a method that overrides the named method,
subjectstill retains the originally declared value (Myron Marston). - Fix random ordering so that it does not cause
randin examples in nested sibling contexts to return the same value (Max Shytikov). - Use the new
backtrace_inclusion_patternsconfig option to ensure that folks who develop code in a directory matching one of the default exclusion patterns (e.g.gems) still get the normal backtrace filtering (Sam Phippen). - Fix ordering of
beforehooks so thatbeforehooks declared inRSpec.configurerun beforebeforehooks declared in a shared context (Michi Huber and Tejas Dinkar). - Fix
Example#full_descriptionso that it gets filled in by the last matcher description (asExample#descriptionalready did) when no doc string has been provided (David Chelimsky). - Fix the memoized methods (
letandsubject) leakingdefine_methodas apublicmethod. (Thomas Holmes and Jon Rowe) (#873) - Fix warnings coming from the test suite. (Pete Higgins)
Deprecations
- Deprecate
Configuration#backtrace_clean_patternsin favor ofConfiguration#backtrace_exclusion_patternsfor greater consistency and symmetry with newbacktrace_inclusion_patternsconfig option (Sam Phippen). - Deprecate
Configuration#requires=in favor of using ruby'srequire. Requires specified by the command line can still be accessed by theConfiguration#requirereader. (Bradley Schaefer) - Deprecate calling
SharedExampleGroupsdefined across sibling contexts (Jon Rowe)
2.13.1 / 2013-03-12
Bug fixes
- Use hook classes as proxies rather than extending hook blocks to support lambdas for before/after/around hooks. (David Chelimsky)
- Fix regression in 2.13.0 that caused confusing behavior when overriding a named subject with an unnamed subject in an inner group and then referencing the outer group subject's name. The fix for this required us to disallow using
superin a named subject (which is confusing, anyway -- named subjects create 2 methods, so which method on the parent example group are yousupering to?) butsuperin an unnamed subject continues to work (Myron Marston). - Do not allow a referenced
letorsubjectinbefore(:all)to cause otherletdeclarations to leak across examples (Myron Marston). - Work around odd ruby 1.9 bug with
String#matchthat was triggered by passing it a regex from aletdeclaration. For more info, see http://bugs.ruby-lang.org/issues/8059 (Aaron Kromer). - Add missing
require 'set'tobase_text_formatter.rb(Tom Anderson).
Deprecations
- Deprecate accessing
letorsubjectdeclarations inbefore(:all). These were not intended to be called in abefore(:all)hook, as they exist to define state that is reset between each example, whilebefore(:all)exists to define state that is shared across examples in an example group (Myron Marston).
2.13.0 / 2013-02-23
Enhancements
- Allow
--profileoption to take a count argument that determines the number of slow examples to dump (Greggory Rothmeier). - Add
subject!that is the analog tolet!. It defines an explicit subject and sets abeforehook that will invoke the subject (Zubin Henner). - Fix
letandsubjectdeclaration so thatsuperandreturncan be used in them, just like in a normal method. (Myron Marston) - Allow output colors to be configured individually. (Charlie Maffitt)
- Always dump slow examples when
--profileoption is given, even when an example failed (Myron Marston).
Bug fixes
- Don't blow up when dumping error output for instances of anonymous error classes (Myron Marston).
- Fix default backtrace filters so lines from projects containing "gems" in the name are not filtered, but lines from installed gems still are (Myron Marston).
- Fix autotest command so that is uses double quotes rather than single quotes for windows compatibility (Jonas Tingeborn).
- Fix
itsso that uses ofsubjectin abeforeorletdeclaration in the parent group continue to reference the parent group's subject. (Olek Janiszewski)
2.12.2 / 2012-12-13
Bug fixes
- Fix
RSpec::Core::RakeTaskso that it is compatible with rake 0.8.7 on ruby 1.8.7. We had accidentally broke it in the 2.12 release (Myron Marston). - Fix
RSpec::Core::RakeTaskso it is tolerant of theRspecconstant for backwards compatibility (Patrick Van Stee)
2.12.1 / 2012-12-01
Bug fixes
- Specs are run even if another at\_exit hook calls
exit. This allows Test::Unit and RSpec to run together. (Suraj N. Kurapati) - Fix full doc string concatenation so that it handles the case of a method string (e.g. "#foo") being nested under a context string (e.g. "when it is tuesday"), so that we get "when it is tuesday #foo" rather than "when it is tuesday#foo". (Myron Marston)
- Restore public API I unintentionally broke in 2.12.0:
RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example)(Myron Marston).
2.12.0 / 2012-11-12
Enhancements
- Add support for custom ordering strategies for groups and examples. (Myron Marston)
- JSON Formatter (Alex Chaffee)
- Refactor rake task internals (Sam Phippen)
- Refactor HtmlFormatter (Pete Hodgson)
- Autotest supports a path to Ruby that contains spaces (dsisnero)
- Provide a helpful warning when a shared example group is redefined. (Mark Burns).
--default_pathcan be specified as--default-line.--line_numbercan be specified as--line-number. Hyphens are more idiomatic command line argument separators (Sam Phippen).- A more useful error message is shown when an invalid command line option is used (Jordi Polo).
- Add
format_docstrings { |str| }config option. It can be used to apply formatting rules to example group and example docstrings. (Alex Tan) - Add support for an
.rspec-localoptions file. This is intended to allow individual developers to set options in a git-ignored file that override the common project options in.rspec. (Sam Phippen) - Support for mocha 0.13.0. (Andy Lindeman)
Bug fixes
- Remove override of
ExampleGroup#ancestors. This is a core ruby method that RSpec shouldn't override. Instead, defineExampleGroup#parent_groups. (Myron Marston) - Limit monkey patching of shared example/context declaration methods (
shared_examples_for, etc.) to just the objects that need it rather than every object in the system (Myron Marston). - Fix Metadata#fetch to support computed values (Sam Goldman).
- Named subject can now be referred to from within subject block in a nested group (tomykaira).
- Fix
fail_fastso that it properly exits when an error occurs in abefore(:all) hook(Bradley Schaefer). - Make the order spec files are loaded consistent, regardless of the order of the files returned by the OS or the order passed at the command line (Jo Liss and Sam Phippen).
- Ensure instance variables from
before(:all)are always exposed fromafter(:all), even if an error occurs inbefore(:all)(Sam Phippen). rspec --initno longer generates an incorrect warning about--configurebeing deprecated (Sam Phippen).- Fix pluralization of
1 seconds(Odin Dutton) - Fix ANSICON url (Jarmo Pertman)
- Use dup of Time so reporting isn't clobbered by examples that modify Time without properly restoring it. (David Chelimsky)
Deprecations
share_asis no longer needed.shared_contextand/orRSpec::SharedContextprovide better mechanisms (Sam Phippen).- Deprecate
RSpec.configurationwith a block (useRSpec.configure).
2.11.1 / 2012-07-18
Bug fixes
- Fix the way we autoload RSpec::Matchers so that custom matchers can be defined before rspec-core has been configured to definitely use rspec-expectations. (Myron Marston)
- Fix typo in --help message printed for -e option. (Jo Liss)
- Fix ruby warnings. (Myron Marston)
- Ignore mock expectation failures when the example has already failed. Mock expectation failures have always been ignored in this situation, but due to my changes in 27059bf1 it was printing a confusing message. (Myron Marston).
2.11.0 / 2012-07-07
Enhancements