Class: RoutesCoverage::Formatters::SummaryText
- Inherits:
-
Base
- Object
- Base
- RoutesCoverage::Formatters::SummaryText
show all
- Defined in:
- lib/routes_coverage/formatters/summary_text.rb
Instance Attribute Summary
Attributes inherited from Base
#groups, #result, #settings
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/routes_coverage/formatters/summary_text.rb', line 18
def format
buffer = [
"Routes coverage is #{result.coverage}% (#{hits_count result})"
]
if groups.any?
buffer += groups.map do |group_name, group_result|
" #{group_name}: #{group_result.coverage}% (#{hits_count group_result})"
end
end
buffer << status
buffer.compact.join("\n")
end
|
#hits_count(result) ⇒ Object
6
7
8
9
10
|
# File 'lib/routes_coverage/formatters/summary_text.rb', line 6
def hits_count(result)
"#{result.hit_routes_count} of #{result.expected_routes_count}"\
"#{"(#{result.total_count} total)" if result.expected_routes_count != result.total_count}"\
" routes hit#{" at #{result.avg_hits} hits average" if result.hit_routes_count.positive?}"
end
|
#status ⇒ Object
12
13
14
15
16
|
# File 'lib/routes_coverage/formatters/summary_text.rb', line 12
def status
return unless settings.minimum_coverage
"Coverage is too low" unless result.coverage_pass?
end
|