Idea: refactor so that it can be used programatically
rstacruz opened this issue · 2 comments
rstacruz commented
It'd be nice to do this:
# Call `retry` around each example in this context
around(:each) { |example| retry example, 3 }
This will be useful to attach custom retry behavior to some tags:
# Attempt to retry any failing Selenium tests due to some net errors
RSpec.configure do |config|
config.around :each, :selenium do |example|
retry example, 3, exceptions: [Net::ConnectError]
end
end
# elsewhere:
describe "your feature", :selenium do
it "should work" do
# run this 3x
end
end
At the moment, to do what the above is supposed to do, you'll need to do describe "your scenario", exceptions_to_retry: [Net::ConnectError], retry: 3, selenium: true do
, which will be very cumbersome to type on every spec that needs it.
dwbutler commented
michaelglass commented
released in 0.4.5, thanks @dwbutler