class Shoulda::Matchers::ActionController::RouteMatcher
@private
Attributes
failure_message[R]
failure_message_when_negated[R]
Public Class Methods
new(method, path, context)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 95 def initialize(method, path, context) @method = method @path = path @context = context end
Public Instance Methods
description()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 118 def description "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" end
in_context(context)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 108 def in_context(context) @context = context self end
matches?(controller)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 113 def matches?(controller) guess_controller!(controller) route_recognized? end
to(*args)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 103 def to(*args) @params = RouteParams.new(args).normalize self end
Private Instance Methods
guess_controller!(controller)
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 124 def guess_controller!(controller) @params[:controller] ||= controller.controller_path end
route_recognized?()
click to toggle source
# File lib/shoulda/matchers/action_controller/route_matcher.rb, line 129 def route_recognized? begin @context.__send__(:assert_routing, { method: @method, path: @path }, @params) @failure_message_when_negated = "Didn't expect to #{description}" true rescue ::ActionController::RoutingError => error @failure_message = error.message false rescue Shoulda::Matchers.assertion_exception_class => error @failure_message = error.message false end end