From dc8fcbaf036981fa08899f8de46afb8a18e4612a Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 7 Jan 2012 13:20:11 +0000 Subject: [PATCH] test: route: add groups tests defined as resources git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8535 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/routing/groups_test.rb | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/test/integration/routing/groups_test.rb b/test/integration/routing/groups_test.rb index 644b2e769..f3044db3b 100644 --- a/test/integration/routing/groups_test.rb +++ b/test/integration/routing/groups_test.rb @@ -18,6 +18,72 @@ require File.expand_path('../../../test_helper', __FILE__) class RoutingGroupsTest < ActionController::IntegrationTest + def test_groups_resources + assert_routing( + { :method => 'get', :path => "/groups" }, + { :controller => 'groups', :action => 'index' } + ) + assert_routing( + { :method => 'get', :path => "/groups.xml" }, + { :controller => 'groups', :action => 'index', :format => 'xml' } + ) + assert_routing( + { :method => 'post', :path => "/groups" }, + { :controller => 'groups', :action => 'create' } + ) + assert_routing( + { :method => 'post', :path => "/groups.xml" }, + { :controller => 'groups', :action => 'create', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/groups/new" }, + { :controller => 'groups', :action => 'new' } + ) + assert_routing( + { :method => 'get', :path => "/groups/new.xml" }, + { :controller => 'groups', :action => 'new', :format => 'xml' } + ) + assert_routing( + { :method => 'get', :path => "/groups/1/edit" }, + { :controller => 'groups', :action => 'edit', :id => '1' } + ) + assert_routing( + { :method => 'get', :path => "/groups/1/autocomplete_for_user" }, + { :controller => 'groups', :action => 'autocomplete_for_user', + :id => '1' } + ) + assert_routing( + { :method => 'get', :path => "/groups/1" }, + { :controller => 'groups', :action => 'show', + :id => '1' } + ) + assert_routing( + { :method => 'get', :path => "/groups/1.xml" }, + { :controller => 'groups', :action => 'show', + :format => 'xml', :id => '1' } + ) + assert_routing( + { :method => 'put', :path => "/groups/1" }, + { :controller => 'groups', :action => 'update', + :id => '1' } + ) + assert_routing( + { :method => 'put', :path => "/groups/1.xml" }, + { :controller => 'groups', :action => 'update', + :format => 'xml', :id => '1' } + ) + assert_routing( + { :method => 'delete', :path => "/groups/1" }, + { :controller => 'groups', :action => 'destroy', + :id => '1' } + ) + assert_routing( + { :method => 'delete', :path => "/groups/1.xml" }, + { :controller => 'groups', :action => 'destroy', + :format => 'xml', :id => '1' } + ) + end + def test_groups assert_routing( { :method => 'post', :path => "/groups/567/users" },