class RouteMechanic::Testing::ErrorInspector
Public Class Methods
new(aggregator)
click to toggle source
@param [RouteMechanic::Testing::ErrorAggregator] aggregator
# File lib/route_mechanic/testing/error_inspector.rb, line 10 def initialize(aggregator) @aggregator = aggregator end
Public Instance Methods
message()
click to toggle source
@return [String]
# File lib/route_mechanic/testing/error_inspector.rb, line 15 def message buffer = [] if unused_actions_errors.present? buffer << " No route matches to the controllers and action methods below" buffer << unused_actions_errors.map {|r| " #{r[:controller]}##{r[:action]}" } end if unused_routes_errors.present? verb_width, path_width = widths buffer << " No controller and action matches to the routes below" buffer << unused_routes_errors.map { |w| " #{w.verb.ljust(verb_width)} #{w.path.ljust(path_width)} #{w.reqs}" } end ["[Route Mechanic]", buffer].join("\n") + "\n" end
Private Instance Methods
widths()
click to toggle source
# File lib/route_mechanic/testing/error_inspector.rb, line 34 def widths [ unused_routes_errors.map { |w| w.verb.length }.max || 0, unused_routes_errors.map { |w| w.path.length }.max || 0 ] end