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

#collect_routes(routes) ⇒ Object



85
86
87
88
89
90
# File 'lib/routes_coverage/formatters/full_text.rb', line 85

def collect_routes(routes)
  # rails 3
  return Result::Inspector.new.collect_all_routes(routes) unless Result::Inspector::NEW_RAILS

  Result::Inspector.new(routes).collect_all_routes
end

#formatObject



104
105
106
# File 'lib/routes_coverage/formatters/full_text.rb', line 104

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

#hit_routes_detailsObject



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/routes_coverage/formatters/full_text.rb', line 92

def hit_routes_details
  # engine routes now are in the same list
  hit_routes = collect_routes(result.hit_routes)
  pending_routes = collect_routes(result.pending_routes)

  "    \#{routes_section(RouteFormatter.new(result, settings, output_hits: true), 'Covered routes:', hit_routes)}\n\n    \#{routes_section(RouteFormatter.new(result, settings), 'Pending routes:', pending_routes)}\n  TXT\nend\n"

#routes_section(formatter, title, routes) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/routes_coverage/formatters/full_text.rb', line 72

def routes_section(formatter, title, routes)
  formatter.buffer << title

  if routes.none?
    formatter.no_routes
  else
    formatter.header routes
    formatter.section routes
  end

  formatter.result
end