class Shoulda::ActionController::Matchers::RouteMatcher
:nodoc:
def description
def description "route #{@method.to_s.upcase} #{@path} to/from #{@params.inspect}" end
def guess_controller!
def guess_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) @controller = controller guess_controller! stringify_params! route_recognized? end
def route_recognized?
def route_recognized? begin @context.send(:assert_routing, { :method => @method, :path => @path }, @params) @negative_failure_message = "Didn't expect to #{description}" true rescue ::ActionController::RoutingError => error @failure_message = error.message false rescue Test::Unit::AssertionFailedError => error @failure_message = error.message false end end
def stringify_params!
def stringify_params! @params.each do |key, value| @params[key] = value.to_param end end
def to(params)
def to(params) @params = params self end