Module: Merb::Test::Rspec::RouteMatchers

Defined in:
lib/merb-core/test/matchers/route_matchers.rb

Defined Under Namespace

Classes: ParameterMatcher, RouteToMatcher

Instance Method Summary collapse

Instance Method Details

#route_to(klass_or_name, action) ⇒ Object

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")


134
135
136
# 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