Class: Minitest::Distributed::ResultAggregate

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

Instance Method Summary collapse

Instance Method Details

#abort?Boolean

Returns:

  • (Boolean)

67
68
69
70
71
72
73
# File 'lib/minitest/distributed/result_aggregate.rb', line 67

def abort?
  if (max = max_failures)
    total_failures >= max
  else
    false
  end
end

#all_runs_reported?Boolean

Returns:

  • (Boolean)

81
82
83
# File 'lib/minitest/distributed/result_aggregate.rb', line 81

def all_runs_reported?
  unique_runs == reported_results
end

#complete?Boolean

Returns:

  • (Boolean)

62
63
64
# File 'lib/minitest/distributed/result_aggregate.rb', line 62

def complete?
  acks == size
end

#passed?Boolean

Returns:

  • (Boolean)

91
92
93
# File 'lib/minitest/distributed/result_aggregate.rb', line 91

def passed?
  total_failures == 0
end

#reported_resultsObject


57
58
59
# File 'lib/minitest/distributed/result_aggregate.rb', line 57

def reported_results
  passes + failures + errors + skips
end

#to_sObject


43
44
45
46
47
48
49
# File 'lib/minitest/distributed/result_aggregate.rb', line 43

def to_s
  str = +"#{runs} runs, #{assertions} assertions, #{passes} passes, #{failures} failures, #{errors} errors"
  str << ", #{skips} skips" if skips > 0
  str << ", #{requeues} re-queued" if requeues > 0
  str << ", #{discards} discarded" if discards > 0
  str
end

#total_failuresObject


86
87
88
# File 'lib/minitest/distributed/result_aggregate.rb', line 86

def total_failures
  failures + errors
end

#unique_runsObject


52
53
54
# File 'lib/minitest/distributed/result_aggregate.rb', line 52

def unique_runs
  runs - requeues - discards
end

#update_with_result(runnable_result) ⇒ Object


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/minitest/distributed/result_aggregate.rb', line 26

def update_with_result(runnable_result)
  case (result_type = ResultType.of(runnable_result.committed_result))
  when ResultType::Passed then self.passes += 1
  when ResultType::Failed then self.failures += 1
  when ResultType::Error then self.errors += 1
  when ResultType::Skipped then self.skips += 1
  when ResultType::Discarded then self.discards += 1
  when ResultType::Requeued then self.requeues += 1
  else T.absurd(result_type)
  end

  self.acks += 1 if runnable_result.final? && runnable_result.commit.success?
  self.runs += 1
  self.assertions += runnable_result.committed_result.assertions
end

#valid?Boolean

Returns:

  • (Boolean)

76
77
78
# File 'lib/minitest/distributed/result_aggregate.rb', line 76

def valid?
  all_runs_reported? && (complete? || abort?)
end