class Shoulda::Matchers::ActionController::RouteMatcher
@private
def description
def description "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" end
def guess_controller!(controller)
def guess_controller!(controller) @params[:controller] ||= controller.controller_path end
def in_context(context)
def in_context(context) @context = context self end
def initialize(method, path, context)
def initialize(method, path, context) @method = method @path = path @context = context end
def matches?(controller)
def matches?(controller) guess_controller!(controller) route_recognized? end
def route_recognized?
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
def to(*args)
def to(*args) @params = RouteParams.new(args).normalize self end