Class: Minitest::Requeue

Inherits:
Skip
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/minitest/distributed/result_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, original_result:) ⇒ Requeue

Returns a new instance of Requeue.



48
49
50
51
# File 'lib/minitest/distributed/result_type.rb', line 48

def initialize(message, original_result:)
  @original_result = original_result
  super(message)
end

Class Method Details

.wrap(result, attempt:, max_attempts:) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/minitest/distributed/result_type.rb', line 59

def self.wrap(result, attempt:, max_attempts:)
  failure = T.must(result.failure)

  message = "#{failure.message}\n\nThe test will be retried (attempt #{attempt} of #{max_attempts})"
  requeue_assertion = Minitest::Requeue.new(message, original_result: result)
  requeue_assertion.set_backtrace(failure.backtrace)

  requeued_result = result.dup
  requeued_result.failures = [requeue_assertion]
  requeued_result
end

Instance Method Details

#result_labelObject



54
55
56
# File 'lib/minitest/distributed/result_type.rb', line 54

def result_label
  "Requeued"
end