Class: RouteMechanic::Testing::RouteWrapper

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/route_mechanic/testing/route_wrapper.rb

Overview

This class just wraps ActionDispatch::Journey::Route

Instance Method Summary collapse

Instance Method Details

#actionObject



27
28
29
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 27

def action
  parts.include?(:action) ? ":action" : requirements[:action]
end

#controllerObject



23
24
25
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 23

def controller
  parts.include?(:controller) ? ":controller" : requirements[:controller]
end

#endpointObject



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

Returns:

  • (Boolean)


31
32
33
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 31

def internal?
  internal
end

#pathObject



11
12
13
# File 'lib/route_mechanic/testing/route_wrapper.rb', line 11

def path
  super.spec.to_s
end

#reqsObject



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