# File lib/rspec/rails/matchers/routing_matchers.rb, line 8 def initialize(scope, *expected) @scope = scope @expected_options = expected[1] || {} if Hash === expected[0] @expected_options.merge!(expected[0]) else controller, action = expected[0].split('#') @expected_options.merge!(:controller => controller, :action => action) end end
# File lib/rspec/rails/matchers/routing_matchers.rb, line 19 def description "route #{@verb_to_path_map.inspect} to #{@expected_options.inspect}" end
@api private
# File lib/rspec/rails/matchers/routing_matchers.rb, line 39 def failure_message_for_should rescued_exception.message end
@api private
# File lib/rspec/rails/matchers/routing_matchers.rb, line 24 def matches?(verb_to_path_map) @verb_to_path_map = verb_to_path_map # assert_recognizes does not consider ActionController::RoutingError an # assertion failure, so we have to capture that and Assertion here. match_unless_raises ActiveSupport::TestCase::Assertion, ActionController::RoutingError do path, query = *verb_to_path_map.values.first.split('?') @scope.assert_recognizes( @expected_options, {:method => verb_to_path_map.keys.first, :path => path}, Rack::Utils::parse_query(query) ) end end
Generated with the Darkfish Rdoc Generator 2.