Class: CemAcpt::Bolt::SummaryResults
Overview
Class that holds the results of the entire Bolt test suite.
Instance Method Summary
collapse
#finalize!, #finalized?, #initialize, #method_missing, #respond_to_missing?, #to_a
Instance Method Details
#action ⇒ Object
75
76
77
78
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 75
def action
require_finalized(binding)
map { |rs| rs.results.map(&:action).uniq }.flatten.uniq
end
|
#error ⇒ Object
12
13
14
15
16
17
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 12
def error
require_finalized(binding)
return unless error?
@error ||= find { |r| !r.success? }
end
|
#error? ⇒ Boolean
19
20
21
22
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 19
def error?
require_finalized(binding)
!success?
end
|
#failure_count ⇒ Object
34
35
36
37
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 34
def failure_count
require_finalized(binding)
@failure_count ||= length - success_count
end
|
#inspect ⇒ Object
64
65
66
67
68
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 64
def inspect
return "#<#{self.class}:#{object_id} unfinalized>" unless finalized?
"#<#{self.class}:#{object_id} #{self}>"
end
|
#results ⇒ Object
80
81
82
83
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 80
def results
require_finalized(binding)
@results ||= map(&:results).flatten
end
|
#results? ⇒ Boolean
85
86
87
88
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 85
def results?
require_finalized(binding)
!results.empty?
end
|
#status ⇒ Object
39
40
41
42
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 39
def status
require_finalized(binding)
success? ? 0 : 1
end
|
#status_str ⇒ Object
44
45
46
47
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 44
def status_str
require_finalized(binding)
success? ? 'passed' : 'failed'
end
|
#success? ⇒ Boolean
24
25
26
27
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 24
def success?
require_finalized(binding)
@success ||= all?(&:success?)
end
|
#success_count ⇒ Object
29
30
31
32
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 29
def success_count
require_finalized(binding)
@success_count ||= count(&:success?)
end
|
#summary ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 49
def summary
require_finalized(binding)
@summary ||= [
"status: #{status_str}",
"tests total: #{length}",
"tests succeeded: #{success_count}",
"tests failed: #{failure_count}",
].join(', ')
end
|
#summary? ⇒ Boolean
59
60
61
62
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 59
def summary?
require_finalized(binding)
true
end
|
#to_h ⇒ Object
70
71
72
73
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 70
def to_h
require_finalized(binding)
{ 'summary' => summary, 'status' => status, 'results' => map(&:to_h) }
end
|
#to_s ⇒ Object
90
91
92
93
|
# File 'lib/cem_acpt/bolt/summary_results.rb', line 90
def to_s
require_finalized(binding)
JSON.pretty_generate(to_h)
end
|