Class: RoutesCoverage::Formatters::FullText

Inherits:
SummaryText
  • Object
show all
Defined in:
lib/routes_coverage/formatters/full_text.rb

Defined Under Namespace

Classes: Inspector, RouteFormatter

Instance Attribute Summary

Attributes inherited from SummaryText

#result, #settings

Instance Method Summary collapse

Methods inherited from SummaryText

#hits_count, #initialize, #status

Constructor Details

This class inherits a constructor from RoutesCoverage::Formatters::SummaryText

Instance Method Details

#formatObject



93
94
95
# File 'lib/routes_coverage/formatters/full_text.rb', line 93

def format
  "\nRoutes coverage is #{result.coverage}% (#{hits_count})#{status}\n\n#{hit_routes}"
end

#hit_routesObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/routes_coverage/formatters/full_text.rb', line 74

def hit_routes
  routes = result.hit_routes

  # verb_width = routes.map{ |r| r[:verb].length }.max
  # path_width = routes.map{ |r| r[:path].length }.max

  [
    "Covered routes:",
    # "#{"Verb".ljust(verb_width)} #{"Path".ljust(path_width)} Reqs",
    # routes.map do |r|
    #   "#{r.verb.ljust(verb_width)} #{r.path.ljust(path_width)} #{r.reqs}"
    # end
    Inspector.new(routes).format(RouteFormatter.new(result, settings, true)),
    nil,
    "Pending routes:",
    Inspector.new(result.pending_routes).format(RouteFormatter.new),
  ].flatten.join("\n")
end