rspec-retry not working? — check your rspec config

Kevin McCarthy
1 min readMar 21, 2021

TL:DR we had to remove meta[:aggregate_failures] = true from our spec_helper to make rspec-retry work

When trying to use rspec-retry we found it wasn’t retrying. In the stack trace between the normal failure we saw reference to rspec-retry.

gems/rspec-retry-0.6.2/lib/rspec/retry.rb:37:in `block (2 levels) in setup'

How we fixed it

The problem came down to this section of our helper file

RSpec.configure do |config|
.....
config.define_derived_metadata do |meta|
meta[:aggregate_failures] = true
end

...
...
end

By deleting these highlighted lines we got rspec-retry working.

Getting aggregate_failures and rspec-retry working together?

Sorry, do not know this one.

It seems aggregating failures (so you can see if multiple parts of a single test failed) intereferes with how rspec-retry does its retries. We did not attempt to get the two working together as we were happy to take the trade-off of losing aggregated failures to get us rspec-retry.

--

--