Module: Minitest::Retry::ClassMethods

Defined in:
lib/minitest/retry.rb

Instance Method Summary collapse

Instance Method Details

#run_one_method(klass, method_name) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/minitest/retry.rb', line 64

def run_one_method(klass, method_name)
  result = super(klass, method_name)
  return result unless Minitest::Retry.failure_to_retry?(result.failures)
  if !result.skipped?
    Minitest::Retry.failure_callback.call(klass, method_name, result) if Minitest::Retry.failure_callback
    Minitest::Retry.retry_count.times do |count|
      Minitest::Retry.retry_callback.call(klass, method_name, count + 1, result) if Minitest::Retry.retry_callback
      if Minitest::Retry.verbose && Minitest::Retry.io
        msg = "[MinitestRetry] retry '%s' count: %s,  msg: %s\n" %
          [method_name, count + 1, result.failures.map(&:message).join(",")]
        Minitest::Retry.io.puts(msg)
      end

      result = super(klass, method_name)
      break if result.failures.empty?
    end

    if Minitest::Retry.consistent_failure_callback && !result.failures.empty?
      Minitest::Retry.consistent_failure_callback.call(klass, method_name, result)
    end
  end
  result
end