Class: Minitest::Reporters::FastCIReporter
- Inherits:
-
Object
- Object
- Minitest::Reporters::FastCIReporter
show all
- Defined in:
- lib/minitest/reporters/fastci_reporter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of FastCIReporter.
29
30
31
32
33
34
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 29
def initialize
@tests = {}
@test_results = {}
@ids = {}
@events = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
115
116
117
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 115
def method_missing(method, *args)
return
end
|
Instance Attribute Details
#ids ⇒ Object
Returns the value of attribute ids.
27
28
29
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 27
def ids
@ids
end
|
#test_results ⇒ Object
Returns the value of attribute test_results.
27
28
29
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 27
def test_results
@test_results
end
|
#tests ⇒ Object
Returns the value of attribute tests.
27
28
29
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 27
def tests
@tests
end
|
Instance Method Details
#before_test(test) ⇒ Object
53
54
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 53
def before_test(test)
end
|
#get_output ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 43
def get_output
return if $stdout.pos == 0
$stdout.rewind
res = $stdout.read
$stdout.flush
$stdout.rewind
return unless res
res.strip.chomp if res.strip.chomp != ""
end
|
#passed? ⇒ Boolean
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 99
def passed?
results = []
test_results.map do |path, file_results|
file_results['1'].each do |id, test_result|
next if id == :description
if test_result[:status] == 'failed'
results << false
else
results << true
end
end
end
return results.any? {|reult| !result }
end
|
#prerecord(klass, name) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 56
def prerecord(klass, name)
description = test_description(name)
path = test_path(klass.name)
test_results[path] ||= { '1' => {} }
id = (test_results[path]['1'].keys.size + 1).to_s
ids[description] = id
test_results[path]['1'][id] ||= { status: 'pending' }
test_results[path]['1'][id][:start] = Minitest.clock_time
tests[path] ||= { run_time: 0.0, file_status: 'pending', test_count: 0, test_counters: { failed: 0, passed: 0, pending: 0 }, '1' => {} }
tests[path][:test_count] += 1
tests[path]['1'][id] ||= { status: 'pending' }
end
|
#record(result) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 73
def record(result)
description = test_description(result.name)
id = ids[description]
path = test_path(result.klass)
test_results[path]['1'][id][:end] = Minitest.clock_time
test_results[path]['1'][id][:run_time] = test_results[path]['1'][id][:end] - test_results[path]['1'][id][:start]
test_results[path]['1'][id][:status] = result_status(result).to_s
test_results[path]['1'][id].delete(:start)
test_results[path]['1'][id].delete(:end)
end
|
#report ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 85
def report
test_results.each do |path, file_results|
file_status = 'pending'
file_results['1'].each do |id, test_result|
next if id == :description
if (test_result[:status] == 'passed') && (file_status != 'failed')
file_status = 'passed'
elsif file_status == 'failed'
file_status = 'failed'
end
end
end
end
|
#start ⇒ Object
36
37
38
39
40
41
|
# File 'lib/minitest/reporters/fastci_reporter.rb', line 36
def start
test_count = Runnable.runnables.sum { |s| s.runnable_methods.count }
msg('start', { test_count: test_count })
@events << ['run_minitest'.upcase, { started_at: Time.current }]
send_events if ENV['RBCI_REMOTE_TESTS'] == 'true'
end
|