spec: embedded reruns option

Change-Id: Ife0294ac8ba33ffdaa7c7149f9ed11e073c1ca23
Reviewed-on: https://gerrit.instructure.com/33367
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
This commit is contained in:
Shawn Meredith 2014-04-15 16:07:00 -06:00
parent 6dd6129c96
commit 94be92c91c
1 changed files with 11 additions and 9 deletions

View File

@ -25,7 +25,7 @@ if CANVAS_RAILS2
end
end
unless CANVAS_RAILS2 || ENV['NO_RERUN']
unless CANVAS_RAILS2
Spec.configure do |c|
c.treat_symbols_as_metadata_keys_with_true_values = true
end
@ -37,14 +37,16 @@ unless CANVAS_RAILS2 || ENV['NO_RERUN']
Timeout::timeout(180) {
example.run
}
e = @example.instance_variable_get('@exception')
if !e.nil? && (attempts += 1) < 2
puts "FAILURE: #{@example.description} \n #{e}".red
puts "RETRYING: #{@example.description}".yellow
@example.instance_variable_set('@exception', nil)
redo
elsif e.nil? && attempts != 0
puts "SUCCESS: retry passed for \n #{@example.description}".green
if ENV['AUTORERUN']
e = @example.instance_variable_get('@exception')
if !e.nil? && (attempts += 1) < 2
puts "FAILURE: #{@example.description} \n #{e}".red
puts "RETRYING: #{@example.description}".yellow
@example.instance_variable_set('@exception', nil)
redo
elsif e.nil? && attempts != 0
puts "SUCCESS: retry passed for \n #{@example.description}".green
end
end
end until true
end