From 07b807bdc89e01286ddce6f87db61c776b722a16 Mon Sep 17 00:00:00 2001 From: Steven Templeman Date: Tue, 13 Jun 2023 17:44:23 -0700 Subject: [PATCH] Allow for RSpec.configuration.exponential_backoff as well as RSpec.configuration.default_sleep_interval to be used for exponential backoff --- lib/rspec/retry.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rspec/retry.rb b/lib/rspec/retry.rb index 19ef16e..4b9ebf7 100644 --- a/lib/rspec/retry.rb +++ b/lib/rspec/retry.rb @@ -78,13 +78,12 @@ def clear_lets end def sleep_interval - if ex.metadata[:exponential_backoff] - 2**(current_example.attempts-1) * ex.metadata[:retry_wait] + if ex.metadata[:exponential_backoff] || RSpec.configuration.exponential_backoff + 2**(current_example.attempts-1) * (ex.metadata[:retry_wait] || RSpec.configuration.default_sleep_interval) else - ex.metadata[:retry_wait] || - RSpec.configuration.default_sleep_interval + ex.metadata[:retry_wait] || RSpec.configuration.default_sleep_interval end - end + end def exceptions_to_hard_fail ex.metadata[:exceptions_to_hard_fail] ||