Class: RouteMechanic::Testing::ErrorInspector
- Inherits:
-
Object
- Object
- RouteMechanic::Testing::ErrorInspector
- Extended by:
- Forwardable
- Defined in:
- lib/route_mechanic/testing/error_inspector.rb
Instance Method Summary collapse
-
#initialize(aggregator) ⇒ ErrorInspector
constructor
A new instance of ErrorInspector.
- #message ⇒ String
Constructor Details
#initialize(aggregator) ⇒ ErrorInspector
Returns a new instance of ErrorInspector.
10 11 12 |
# File 'lib/route_mechanic/testing/error_inspector.rb', line 10 def initialize(aggregator) @aggregator = aggregator end |
Instance Method Details
#message ⇒ String
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/route_mechanic/testing/error_inspector.rb', line 15 def 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 |