Class: RoutesCoverage::Formatters::FullText

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

Defined Under Namespace

Classes: RouteFormatter

Instance Attribute Summary

Attributes inherited from Base

#groups, #result, #settings

Instance Method Summary collapse

Methods inherited from SummaryText

#hits_count, #status

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#formatObject



72
73
74
# File 'lib/routes_coverage/formatters/full_text.rb', line 72

def format
  "#{super}\n\n#{hit_routes}"
end

#hit_routesObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/routes_coverage/formatters/full_text.rb', line 52

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
    #TODO: replace formatter
    Result::Inspector.new(routes).format(RouteFormatter.new(result, settings, true)),
    nil,
    "Pending routes:",
    Result::Inspector.new(result.pending_routes).format(RouteFormatter.new),
  ].flatten.join("\n")
end