module Rspec::Flaky::Test
Constants
- VERSION
Public Class Methods
apply!()
click to toggle source
# File lib/rspec/flaky/test.rb, line 6 def self.apply! RSpec.configure do |config| config.add_setting :flaky_tries, default: 3 config.around(:example) do |example| next example.run unless example.metadata[:flaky] tries = RSpec.configuration.flaky_tries current_example = RSpec.current_example tries.times do |try_count| # Clear the exception before we retry. current_example.instance_variable_set(:@exception, nil) example.run break unless current_example.exception end end end end