module Shoulda::ActionController::Macros
def should_route(method, path, options)
:action => :show, :id => 1, :user_id => 1
should_route :get, "/users/1/posts/1",
should_route :delete, "/posts/1", :action => :destroy, :id => 1
should_route :put, "/posts/1", :action => :update, :id => 1
should_route :edit, "/posts/1", :action => :show, :id => 1
should_route :get, "/posts/1", :action => :show, :id => 1
should_route :post, "/posts", :action => :create
should_route :get, "/posts/new", :action => :new
should_route :get, "/posts", :controller => :posts, :action => :index
Examples:
+to_param+ is called on the +options+ given.
based on the current test.
If you don't specify a :controller, it will try to guess the controller
given +options+.
+method+ on the given +path+, and asserts that it routes to the
Macro that creates a routing test. It tries to use the given HTTP
def should_route(method, path, options) unless options[:controller] options[:controller] = self.name.gsub(/ControllerTest$/, '').tableize end matcher = route(method, path).to(options) should matcher.description do assert_accepts matcher.in_context(self), self end end