Not that I knew ... although you could make it a little shorter by wrapping all the methods and actions in a hash:
should "be redirected" do
{
:get => :new,
:post => :create,
}.each do |method, action|
send(method, action)
assert_redirected_to(root_path)
end
end
Edit: so yes, this is probably too much, but here itβs different:
should "be redirected" do
ActionController::Routing::Routes.named_routes.routes.each do |name, route|
if route.requirements[:controller] == @controller.controller_name
send(route.conditions[:method], route.requirements[:action])
assert_redirected_to(root_path)
end
end
end
, : , "" , ,
map.resources :foo, :collection => {
:bar => [:get, :post]
}
GET-.
, URL- , , . , :)