Class: EksaMination::Formatters::JSONFormatter
- Inherits:
-
Base
- Object
- Base
- EksaMination::Formatters::JSONFormatter
show all
- Defined in:
- lib/eksa-mination/formatters/json.rb
Constant Summary
Constants inherited
from Base
Base::COLORS
Instance Attribute Summary
Attributes inherited from Base
#example_count, #failures, #results, #skipped, #use_color
Instance Method Summary
collapse
Methods inherited from Base
#group_finished, #group_started, #initialize
Instance Method Details
#report_failure(example, error) ⇒ Object
8
|
# File 'lib/eksa-mination/formatters/json.rb', line 8
def report_failure(example, error); super; end
|
#report_skipped(example) ⇒ Object
9
|
# File 'lib/eksa-mination/formatters/json.rb', line 9
def report_skipped(example); super; end
|
#report_success(example) ⇒ Object
7
|
# File 'lib/eksa-mination/formatters/json.rb', line 7
def report_success(example); super; end
|
#summarize ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/eksa-mination/formatters/json.rb', line 11
def summarize
data = {
version: EksaMination::VERSION,
summary: {
example_count: @example_count,
failure_count: @failures.size,
pending_count: @skipped.size
},
examples: @results.map do |res|
example = res[:example]
item = {
description: example.description,
full_description: example.full_description,
status: res[:status].to_s,
file_path: example.file_path,
line_number: example.line_number
}
if res[:status] == :failed
error = res[:error]
item[:exception] = {
class: error.class.name,
message: error.message,
backtrace: error.backtrace
}
end
item
end
}
puts JSON.pretty_generate(data)
end
|