Class: Profiler::Collectors::TestCollector
Instance Attribute Summary
#profile
Instance Method Summary
collapse
descendants, inherited, #name, #panel_content, #render_html, #render_mode, #subscribe
Constructor Details
#initialize(profile, test_name:, test_file:, test_line:, framework:) ⇒ TestCollector
Returns a new instance of TestCollector.
8
9
10
11
12
13
14
15
16
|
# File 'lib/profiler/collectors/test_collector.rb', line 8
def initialize(profile, test_name:, test_file:, test_line:, framework:)
super(profile)
@test_name = test_name
@test_file = test_file
@test_line = test_line
@framework = framework
@status = "running"
@exception_message = nil
end
|
Instance Method Details
#collect ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/profiler/collectors/test_collector.rb', line 47
def collect
store_data({
test_name: @test_name,
test_file: @test_file,
test_line: @test_line,
framework: @framework.to_s,
status: @status,
exception_message: @exception_message,
assertions: @assertions,
skip_reason: @skip_reason
})
end
|
#has_data? ⇒ Boolean
60
61
62
|
# File 'lib/profiler/collectors/test_collector.rb', line 60
def has_data?
true
end
|
#icon ⇒ Object
18
19
20
|
# File 'lib/profiler/collectors/test_collector.rb', line 18
def icon
"🧪"
end
|
#priority ⇒ Object
22
23
24
|
# File 'lib/profiler/collectors/test_collector.rb', line 22
def priority
5
end
|
#tab_config ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/profiler/collectors/test_collector.rb', line 26
def tab_config
{
key: "test",
label: "Test",
icon: icon,
priority: priority,
enabled: true,
default_active: true
}
end
|
64
65
66
67
68
69
70
71
72
|
# File 'lib/profiler/collectors/test_collector.rb', line 64
def toolbar_summary
color = case @status
when "passed" then "green"
when "failed" then "red"
when "pending" then "orange"
else "gray"
end
{ text: @status, color: color }
end
|
42
43
44
45
|
# File 'lib/profiler/collectors/test_collector.rb', line 42
def (assertions: nil, skip_reason: nil)
@assertions = assertions
@skip_reason = skip_reason
end
|
#update_status(status, exception_message = nil) ⇒ Object
37
38
39
40
|
# File 'lib/profiler/collectors/test_collector.rb', line 37
def update_status(status, exception_message = nil)
@status = status
@exception_message = exception_message
end
|