Last active
February 23, 2016 13:15
-
-
Save anolson/fdfec936b4fae9492234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Re-try randomly failing examples | |
config.around(:each) do |ex| | |
attempts = [ENV["RSPEC_ATTEMPTS"].to_i, 1].max | |
attempts.times do |i| | |
example = RSpec.current_example | |
example.instance_variable_set("@exception", nil) | |
if i > 0 | |
puts "Re-running rspec example #{example.location}. Attempt #{i + 1} of #{attempts}" | |
end | |
ex.run | |
break if example.exception.nil? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment