module Merb::Test::Rspec::RouteMatchers

Public Instance Methods

route_to(klass_or_name, action) click to toggle source

Passes when the actual route parameters match the expected controller class and controller action. Exposes a with method for specifying parameters.

Parameters

klass_or_name<Class, String>

The controller class or class name to match routes for.

action<~to_s>

The name of the action to match routes for.

Example

# Passes if a GET request to "/" is routed to the Widgets controller's
# index action.
request_to("/", :get).should route_to(Widgets, :index)

# Use the 'with' method for parameter checks
request_to("/123").should route_to(widgets, :show).with(:id => "123")
# File lib/merb-core/test/matchers/route_matchers.rb, line 134
def route_to(klass_or_name, action)
  RouteToMatcher.new(klass_or_name, action)
end