RSpec 3.9 has been released, and RSpec team changes.

Jon Rowe

Oct 16, 2019

RSpec 3.9 has just been released! As the RSpec project follows semantic versioning, anyone already using RSpec 3 should be able to upgrade to this version seemlessly, but if we have introduced a regression please let us know, and we'll get a patch release out to sort it out as soon as possible.

We're sad to announce that Penelope Phippen has retired from the project, leaving myself, Jon Rowe as the sole lead maintainer going forward, but its not all bad news, we welcome our newest core team member Phil Pirozhkov.

Thank you Penelope for all your hard word over the years and welcome Phil!

This is the last release in which the RSpec gems, rspec, rspec-core, rspec-expectations and rspec-mocks will be in sync with rspec-rails. We'll be launched rspec-rails 4 soon which will be classed as an extension gem and not kept in sync version wise with the core gems, which will allow us to keep rspec-rails in sync with Rails versions, more on that soon.

RSpec continues to receive contributions from all over the world, we had 369 commits and 98 merged pull requests from 52 different contributors who helped make this release happen. Thank you all :)

Notable Changes

Core: Improved error handling

If RSpec encounters an error whilst loading support files, it will now skip loading specs files removing later confusing errors due to the earlier error(s). Additionally when available did_you_mean suggestions will be shown for any LoadErrors that are encountered.

Core: Command Line Interface improvement, --example-matches

With the release of 3.9 you can now use --example-matches to filter your examples via a regular expression, useful if you only know part of an example name or have specs with a common theme across a number of different files.

Core: New Formatter

In 3.9 you will find a new built in formatter option, the failure list formatter, which can be used via the command line as --format f or --format failure_list, or via the RSpec::Configuration#formatter method. This new formatter produces output in a more minimalist "quick fix" style output.

Expectations: respond_to(:new)

The respond_to matcher now special cases :new and checks :initialize if its a standard class method.

Expectations: Empty diff warning

Prior to 3.9 when you had matchers that failed but the items under test produced the same inspect output you'd get a confusing diff were both sides look the same, we now detect this scenario and issue a warning.

Mocks: Improved thread safety

A bonus for people running parralleised specs, 3.9 brings some improvements to our threaded behaviour by adding mutexes to avoid deadlocking errors.

Rails: rails_helper.rb improvements

A minor tweak in 3.9 brining the generated rails_helper.rb inline with Ruby semantics and using __dir__ rather than __FILE__ on newer Rubies.

Rails: New email matchers

Add a new have_enqueued_mail matcher for making it easier to assert on mailer specific active jobs.

Rails: New generators

Version 3.9 brings a couple of new generator scaffolds, you can now generate system specs on Rails 5.1 and above, generate specs for generators and add routes when generating controller specs.

Stats:

Combined:

rspec-core:

rspec-expectations:

rspec-mocks:

rspec-rails:

rspec-support:

Docs

API Docs

Cucumber Features

Release Notes

rspec-core-3.9.0

Full Changelog

Enhancements: * Improve the handling of errors during loading support files, if a file errors before loading specs, RSpec will now skip loading the specs. (David Rodríguez, #2568) * Add support for –example-matches to run examples by regular expression. (Sam Joseph, Matt Rider, @okothkongo1, #2586) * Add did_you_mean suggestions for file names encountering a LoadError outside of examples. (@obromios, #2601) * Add a minimalist quick fix style formatter, only outputs failures as file:line:message. (Romain Tartière, #2614) * Convert string number values to integer when used for RSpec::Configuration#fail_fast (Viktor Fonic, #2634) * Issue warning when invalid values are used for RSpec::Configuration#fail_fast (Viktor Fonic, #2634) * Add support for running the Rake task in a clean environment. (Jon Rowe, #2632) * Indent messages by there example group / example in the documentation formatter. (Samuel Williams, #2649)

rspec-expectations-3.9.0

Full Changelog

Enhancements:

rspec-mocks-3.9.0

Full Changelog

Enhancements:

rspec-rails-3.9.0

Full Changelog

Enhancements

Bug Fixes: