class RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher

Public Class Methods

new(scope, *expected) click to toggle source
# 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

Public Instance Methods

failure_message_for_should() click to toggle source

@api private

# File lib/rspec/rails/matchers/routing_matchers.rb, line 32
def failure_message_for_should
  rescued_exception.message
end
matches?(verb_to_path_map) click to toggle source

@api private

# File lib/rspec/rails/matchers/routing_matchers.rb, line 20
def matches?(verb_to_path_map)
  match_unless_raises ActiveSupport::TestCase::Assertion 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