Class: RouteMechanic::Testing::RouteWrapper
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- RouteMechanic::Testing::RouteWrapper
- Defined in:
- lib/route_mechanic/testing/route_wrapper.rb
Overview
This class just wraps ActionDispatch::Journey::Route
Instance Method Summary collapse
- #action ⇒ Object
- #controller ⇒ Object
- #endpoint ⇒ Object
- #internal? ⇒ Boolean
- #path ⇒ Object
- #reqs ⇒ Object
Instance Method Details
#action ⇒ Object
27 28 29 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 27 def action parts.include?(:action) ? ":action" : requirements[:action] end |
#controller ⇒ Object
23 24 25 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 23 def controller parts.include?(:controller) ? ":controller" : requirements[:controller] end |
#endpoint ⇒ Object
7 8 9 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 7 def endpoint app.dispatcher? ? "#{controller}##{action}" : app.rack_app.inspect end |
#internal? ⇒ Boolean
31 32 33 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 31 def internal? internal end |
#path ⇒ Object
11 12 13 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 11 def path super.spec.to_s end |
#reqs ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 15 def reqs @reqs ||= begin reqs = endpoint reqs += " #{requirements.except(:controller, :action)}" unless requirements.except(:controller, :action).empty? reqs end end |