##// END OF EJS Templates
Use should_route in routing tests....
Jean-Philippe Lang -
r13226:ecda1c7a4f30
parent child
Show More
@@ -17,35 +17,20
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingAccountTest < ActionDispatch::IntegrationTest
20 class RoutingAccountTest < Redmine::RoutingTest
21 def test_account
21 def test_account
22 ["get", "post"].each do |method|
22 should_route 'GET /login' => 'account#login'
23 assert_routing(
23 should_route 'POST /login' => 'account#login'
24 { :method => method, :path => "/login" },
24
25 { :controller => 'account', :action => 'login' }
25 should_route 'GET /logout' => 'account#logout'
26 )
26 should_route 'POST /logout' => 'account#logout'
27 end
27
28 ["get", "post"].each do |method|
28 should_route 'GET /account/register' => 'account#register'
29 assert_routing(
29 should_route 'POST /account/register' => 'account#register'
30 { :method => method, :path => "/logout" },
30
31 { :controller => 'account', :action => 'logout' }
31 should_route 'GET /account/lost_password' => 'account#lost_password'
32 )
32 should_route 'POST /account/lost_password' => 'account#lost_password'
33 end
33
34 ["get", "post"].each do |method|
34 should_route 'GET /account/activate' => 'account#activate'
35 assert_routing(
36 { :method => method, :path => "/account/register" },
37 { :controller => 'account', :action => 'register' }
38 )
39 end
40 ["get", "post"].each do |method|
41 assert_routing(
42 { :method => method, :path => "/account/lost_password" },
43 { :controller => 'account', :action => 'lost_password' }
44 )
45 end
46 assert_routing(
47 { :method => 'get', :path => "/account/activate" },
48 { :controller => 'account', :action => 'activate' }
49 )
50 end
35 end
51 end
36 end
@@ -17,24 +17,15
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingActivitiesTest < ActionDispatch::IntegrationTest
20 class RoutingActivitiesTest < Redmine::RoutingTest
21 def test_activities
21
22 assert_routing(
22 def test_activity
23 { :method => 'get', :path => "/activity" },
23 should_route 'GET /activity' => 'activities#index'
24 { :controller => 'activities', :action => 'index' }
24 should_route 'GET /activity.atom' => 'activities#index', :format => 'atom'
25 )
25 end
26 assert_routing(
26
27 { :method => 'get', :path => "/activity.atom" },
27 def test_project_activity
28 { :controller => 'activities', :action => 'index', :format => 'atom' }
28 should_route 'GET /projects/33/activity' => 'activities#index', :id => '33'
29 )
29 should_route 'GET /projects/33/activity.atom' => 'activities#index', :id => '33', :format => 'atom'
30 assert_routing(
31 { :method => 'get', :path => "/projects/33/activity" },
32 { :controller => 'activities', :action => 'index', :id => '33' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/projects/33/activity.atom" },
36 { :controller => 'activities', :action => 'index', :id => '33',
37 :format => 'atom' }
38 )
39 end
30 end
40 end
31 end
@@ -17,31 +17,13
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingAdminTest < ActionDispatch::IntegrationTest
20 class RoutingAdminTest < Redmine::RoutingTest
21 def test_administration_panel
21 def test_administration_panel
22 assert_routing(
22 should_route 'GET /admin' => 'admin#index'
23 { :method => 'get', :path => "/admin" },
23 should_route 'GET /admin/projects' => 'admin#projects'
24 { :controller => 'admin', :action => 'index' }
24 should_route 'GET /admin/plugins' => 'admin#plugins'
25 )
25 should_route 'GET /admin/info' => 'admin#info'
26 assert_routing(
26 should_route 'GET /admin/test_email' => 'admin#test_email'
27 { :method => 'get', :path => "/admin/projects" },
27 should_route 'POST /admin/default_configuration' => 'admin#default_configuration'
28 { :controller => 'admin', :action => 'projects' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/admin/plugins" },
32 { :controller => 'admin', :action => 'plugins' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/admin/info" },
36 { :controller => 'admin', :action => 'info' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/admin/test_email" },
40 { :controller => 'admin', :action => 'test_email' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/admin/default_configuration" },
44 { :controller => 'admin', :action => 'default_configuration' }
45 )
46 end
28 end
47 end
29 end
@@ -17,37 +17,17
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingAttachmentsTest < ActionDispatch::IntegrationTest
20 class RoutingAttachmentsTest < Redmine::RoutingTest
21 def test_attachments
21 def test_attachments
22 assert_routing(
22 should_route 'GET /attachments/1' => 'attachments#show', :id => '1'
23 { :method => 'get', :path => "/attachments/1" },
23 should_route 'GET /attachments/1/filename.ext' => 'attachments#show', :id => '1', :filename => 'filename.ext'
24 { :controller => 'attachments', :action => 'show', :id => '1' }
24
25 )
25 should_route 'GET /attachments/download/1' => 'attachments#download', :id => '1'
26 assert_routing(
26 should_route 'GET /attachments/download/1/filename.ext' => 'attachments#download', :id => '1', :filename => 'filename.ext'
27 { :method => 'get', :path => "/attachments/1/filename.ext" },
27
28 { :controller => 'attachments', :action => 'show', :id => '1',
28 should_route 'GET /attachments/thumbnail/1' => 'attachments#thumbnail', :id => '1'
29 :filename => 'filename.ext' }
29 should_route 'GET /attachments/thumbnail/1/200' => 'attachments#thumbnail', :id => '1', :size => '200'
30 )
30
31 assert_routing(
31 should_route 'DELETE /attachments/1' => 'attachments#destroy', :id => '1'
32 { :method => 'get', :path => "/attachments/download/1" },
33 { :controller => 'attachments', :action => 'download', :id => '1' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/attachments/download/1/filename.ext" },
37 { :controller => 'attachments', :action => 'download', :id => '1',
38 :filename => 'filename.ext' }
39 )
40 assert_routing(
41 { :method => 'get', :path => "/attachments/thumbnail/1" },
42 { :controller => 'attachments', :action => 'thumbnail', :id => '1' }
43 )
44 assert_routing(
45 { :method => 'get', :path => "/attachments/thumbnail/1/200" },
46 { :controller => 'attachments', :action => 'thumbnail', :id => '1', :size => '200' }
47 )
48 assert_routing(
49 { :method => 'delete', :path => "/attachments/1" },
50 { :controller => 'attachments', :action => 'destroy', :id => '1' }
51 )
52 end
32 end
53 end
33 end
@@ -17,43 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingAuthSourcesTest < ActionDispatch::IntegrationTest
20 class RoutingAuthSourcesTest < Redmine::RoutingTest
21 def test_auth_sources
21 def test_auth_sources
22 assert_routing(
22 should_route 'GET /auth_sources' => 'auth_sources#index'
23 { :method => 'get', :path => "/auth_sources" },
23 should_route 'GET /auth_sources/new' => 'auth_sources#new'
24 { :controller => 'auth_sources', :action => 'index' }
24 should_route 'POST /auth_sources' => 'auth_sources#create'
25 )
25 should_route 'GET /auth_sources/autocomplete_for_new_user' => 'auth_sources#autocomplete_for_new_user'
26 assert_routing(
26
27 { :method => 'get', :path => "/auth_sources/new" },
27 should_route 'GET /auth_sources/1234/edit' => 'auth_sources#edit', :id => '1234'
28 { :controller => 'auth_sources', :action => 'new' }
28 should_route 'PUT /auth_sources/1234' => 'auth_sources#update', :id => '1234'
29 )
29 should_route 'DELETE /auth_sources/1234' => 'auth_sources#destroy', :id => '1234'
30 assert_routing(
30 should_route 'GET /auth_sources/1234/test_connection' => 'auth_sources#test_connection', :id => '1234'
31 { :method => 'post', :path => "/auth_sources" },
32 { :controller => 'auth_sources', :action => 'create' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/auth_sources/1234/edit" },
36 { :controller => 'auth_sources', :action => 'edit',
37 :id => '1234' }
38 )
39 assert_routing(
40 { :method => 'put', :path => "/auth_sources/1234" },
41 { :controller => 'auth_sources', :action => 'update',
42 :id => '1234' }
43 )
44 assert_routing(
45 { :method => 'delete', :path => "/auth_sources/1234" },
46 { :controller => 'auth_sources', :action => 'destroy',
47 :id => '1234' }
48 )
49 assert_routing(
50 { :method => 'get', :path => "/auth_sources/1234/test_connection" },
51 { :controller => 'auth_sources', :action => 'test_connection',
52 :id => '1234' }
53 )
54 assert_routing(
55 { :method => 'get', :path => "/auth_sources/autocomplete_for_new_user" },
56 { :controller => 'auth_sources', :action => 'autocomplete_for_new_user' }
57 )
58 end
31 end
59 end
32 end
@@ -17,11 +17,8
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingAutoCompletesTest < ActionDispatch::IntegrationTest
20 class RoutingAutoCompletesTest < Redmine::RoutingTest
21 def test_auto_completes
21 def test_auto_completes
22 assert_routing(
22 should_route 'GET /issues/auto_complete' => 'auto_completes#issues'
23 { :method => 'get', :path => "/issues/auto_complete" },
24 { :controller => 'auto_completes', :action => 'issues' }
25 )
26 end
23 end
27 end
24 end
@@ -17,44 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingBoardsTest < ActionDispatch::IntegrationTest
20 class RoutingBoardsTest < Redmine::RoutingTest
21 def test_boards
21 def test_boards
22 assert_routing(
22 should_route 'GET /projects/foo/boards' => 'boards#index', :project_id => 'foo'
23 { :method => 'get', :path => "/projects/world_domination/boards" },
23 should_route 'GET /projects/foo/boards/new' => 'boards#new', :project_id => 'foo'
24 { :controller => 'boards', :action => 'index', :project_id => 'world_domination' }
24 should_route 'POST /projects/foo/boards' => 'boards#create', :project_id => 'foo'
25 )
25
26 assert_routing(
26 should_route 'GET /projects/foo/boards/44' => 'boards#show', :project_id => 'foo', :id => '44'
27 { :method => 'get', :path => "/projects/world_domination/boards/new" },
27 should_route 'GET /projects/foo/boards/44.atom' => 'boards#show', :project_id => 'foo', :id => '44', :format => 'atom'
28 { :controller => 'boards', :action => 'new', :project_id => 'world_domination' }
28 should_route 'GET /projects/foo/boards/44/edit' => 'boards#edit', :project_id => 'foo', :id => '44'
29 )
29 should_route 'PUT /projects/foo/boards/44' => 'boards#update', :project_id => 'foo', :id => '44'
30 assert_routing(
30 should_route 'DELETE /projects/foo/boards/44' => 'boards#destroy', :project_id => 'foo', :id => '44'
31 { :method => 'get', :path => "/projects/world_domination/boards/44" },
32 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
33 :id => '44' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/world_domination/boards/44.atom" },
37 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
38 :id => '44', :format => 'atom' }
39 )
40 assert_routing(
41 { :method => 'get', :path => "/projects/world_domination/boards/44/edit" },
42 { :controller => 'boards', :action => 'edit', :project_id => 'world_domination',
43 :id => '44' }
44 )
45 assert_routing(
46 { :method => 'post', :path => "/projects/world_domination/boards" },
47 { :controller => 'boards', :action => 'create', :project_id => 'world_domination' }
48 )
49 assert_routing(
50 { :method => 'put', :path => "/projects/world_domination/boards/44" },
51 { :controller => 'boards', :action => 'update', :project_id => 'world_domination',
52 :id => '44' }
53 )
54 assert_routing(
55 { :method => 'delete', :path => "/projects/world_domination/boards/44" },
56 { :controller => 'boards', :action => 'destroy', :project_id => 'world_domination',
57 :id => '44' }
58 )
59 end
31 end
60 end
32 end
@@ -17,16 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingCalendarsTest < ActionDispatch::IntegrationTest
20 class RoutingCalendarsTest < Redmine::RoutingTest
21 def test_calendars
21 def test_calendars
22 assert_routing(
22 should_route 'GET /issues/calendar' => 'calendars#show'
23 { :method => 'get', :path => "/issues/calendar" },
23 should_route 'GET /projects/foo/issues/calendar' => 'calendars#show', :project_id => 'foo'
24 { :controller => 'calendars', :action => 'show' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/project-name/issues/calendar" },
28 { :controller => 'calendars', :action => 'show',
29 :project_id => 'project-name' }
30 )
31 end
24 end
32 end
25 end
@@ -17,16 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingCommentsTest < ActionDispatch::IntegrationTest
20 class RoutingCommentsTest < Redmine::RoutingTest
21 def test_comments
21 def test_comments
22 assert_routing(
22 should_route 'POST /news/567/comments' => 'comments#create', :id => '567'
23 { :method => 'post', :path => "/news/567/comments" },
23 should_route 'DELETE /news/567/comments/15' => 'comments#destroy', :id => '567', :comment_id => '15'
24 { :controller => 'comments', :action => 'create', :id => '567' }
25 )
26 assert_routing(
27 { :method => 'delete', :path => "/news/567/comments/15" },
28 { :controller => 'comments', :action => 'destroy', :id => '567',
29 :comment_id => '15' }
30 )
31 end
24 end
32 end
25 end
@@ -17,22 +17,14
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingContextMenusTest < ActionDispatch::IntegrationTest
20 class RoutingContextMenusTest < Redmine::RoutingTest
21 def test_context_menus_time_entries
21 def test_context_menus_time_entries
22 ["get", "post"].each do |method|
22 should_route 'GET /time_entries/context_menu' => 'context_menus#time_entries'
23 assert_routing(
23 should_route 'POST /time_entries/context_menu' => 'context_menus#time_entries'
24 { :method => method, :path => "/time_entries/context_menu" },
25 { :controller => 'context_menus', :action => 'time_entries' }
26 )
27 end
28 end
24 end
29
25
30 def test_context_menus_issues
26 def test_context_menus_issues
31 ["get", "post"].each do |method|
27 should_route 'GET /issues/context_menu' => 'context_menus#issues'
32 assert_routing(
28 should_route 'POST /issues/context_menu' => 'context_menus#issues'
33 { :method => method, :path => "/issues/context_menu" },
34 { :controller => 'context_menus', :action => 'issues' }
35 )
36 end
37 end
29 end
38 end
30 end
@@ -17,31 +17,14
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingCustomFieldsTest < ActionDispatch::IntegrationTest
20 class RoutingCustomFieldsTest < Redmine::RoutingTest
21 def test_custom_fields
21 def test_custom_fields
22 assert_routing(
22 should_route 'GET /custom_fields' => 'custom_fields#index'
23 { :method => 'get', :path => "/custom_fields" },
23 should_route 'GET /custom_fields/new' => 'custom_fields#new'
24 { :controller => 'custom_fields', :action => 'index' }
24 should_route 'POST /custom_fields' => 'custom_fields#create'
25 )
25
26 assert_routing(
26 should_route 'GET /custom_fields/2/edit' => 'custom_fields#edit', :id => '2'
27 { :method => 'get', :path => "/custom_fields/new" },
27 should_route 'PUT /custom_fields/2' => 'custom_fields#update', :id => '2'
28 { :controller => 'custom_fields', :action => 'new' }
28 should_route 'DELETE /custom_fields/2' => 'custom_fields#destroy', :id => '2'
29 )
30 assert_routing(
31 { :method => 'post', :path => "/custom_fields" },
32 { :controller => 'custom_fields', :action => 'create' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/custom_fields/2/edit" },
36 { :controller => 'custom_fields', :action => 'edit', :id => '2' }
37 )
38 assert_routing(
39 { :method => 'put', :path => "/custom_fields/2" },
40 { :controller => 'custom_fields', :action => 'update', :id => '2' }
41 )
42 assert_routing(
43 { :method => 'delete', :path => "/custom_fields/2" },
44 { :controller => 'custom_fields', :action => 'destroy', :id => '2' }
45 )
46 end
29 end
47 end
30 end
@@ -17,42 +17,21
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingDocumentsTest < ActionDispatch::IntegrationTest
20 class RoutingDocumentsTest < Redmine::RoutingTest
21 def test_documents_scoped_under_project
21 def test_documents_scoped_under_project
22 assert_routing(
22 should_route 'GET /projects/567/documents' => 'documents#index', :project_id => '567'
23 { :method => 'get', :path => "/projects/567/documents" },
23 should_route 'GET /projects/567/documents/new' => 'documents#new', :project_id => '567'
24 { :controller => 'documents', :action => 'index', :project_id => '567' }
24 should_route 'POST /projects/567/documents' => 'documents#create', :project_id => '567'
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/567/documents/new" },
28 { :controller => 'documents', :action => 'new', :project_id => '567' }
29 )
30 assert_routing(
31 { :method => 'post', :path => "/projects/567/documents" },
32 { :controller => 'documents', :action => 'create', :project_id => '567' }
33 )
34 end
25 end
35
26
36 def test_documents
27 def test_documents
37 assert_routing(
28 should_route 'GET /documents/22' => 'documents#show', :id => '22'
38 { :method => 'get', :path => "/documents/22" },
29 should_route 'GET /documents/22/edit' => 'documents#edit', :id => '22'
39 { :controller => 'documents', :action => 'show', :id => '22' }
30 should_route 'PUT /documents/22' => 'documents#update', :id => '22'
40 )
31 should_route 'DELETE /documents/22' => 'documents#destroy', :id => '22'
41 assert_routing(
32 end
42 { :method => 'get', :path => "/documents/22/edit" },
33
43 { :controller => 'documents', :action => 'edit', :id => '22' }
34 def test_document_attachments
44 )
35 should_route 'POST /documents/22/add_attachment' => 'documents#add_attachment', :id => '22'
45 assert_routing(
46 { :method => 'put', :path => "/documents/22" },
47 { :controller => 'documents', :action => 'update', :id => '22' }
48 )
49 assert_routing(
50 { :method => 'delete', :path => "/documents/22" },
51 { :controller => 'documents', :action => 'destroy', :id => '22' }
52 )
53 assert_routing(
54 { :method => 'post', :path => "/documents/22/add_attachment" },
55 { :controller => 'documents', :action => 'add_attachment', :id => '22' }
56 )
57 end
36 end
58 end
37 end
@@ -17,31 +17,14
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingEnumerationsTest < ActionDispatch::IntegrationTest
20 class RoutingEnumerationsTest < Redmine::RoutingTest
21 def test_enumerations
21 def test_enumerations
22 assert_routing(
22 should_route 'GET /enumerations' => 'enumerations#index'
23 { :method => 'get', :path => "/enumerations" },
23 should_route 'GET /enumerations/new' => 'enumerations#new'
24 { :controller => 'enumerations', :action => 'index' }
24 should_route 'POST /enumerations' => 'enumerations#create'
25 )
25
26 assert_routing(
26 should_route 'GET /enumerations/2/edit' => 'enumerations#edit', :id => '2'
27 { :method => 'get', :path => "/enumerations/new" },
27 should_route 'PUT /enumerations/2' => 'enumerations#update', :id => '2'
28 { :controller => 'enumerations', :action => 'new' }
28 should_route 'DELETE /enumerations/2' => 'enumerations#destroy', :id => '2'
29 )
30 assert_routing(
31 { :method => 'post', :path => "/enumerations" },
32 { :controller => 'enumerations', :action => 'create' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/enumerations/2/edit" },
36 { :controller => 'enumerations', :action => 'edit', :id => '2' }
37 )
38 assert_routing(
39 { :method => 'put', :path => "/enumerations/2" },
40 { :controller => 'enumerations', :action => 'update', :id => '2' }
41 )
42 assert_routing(
43 { :method => 'delete', :path => "/enumerations/2" },
44 { :controller => 'enumerations', :action => 'destroy', :id => '2' }
45 )
46 end
29 end
47 end
30 end
@@ -17,19 +17,10
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingFilesTest < ActionDispatch::IntegrationTest
20 class RoutingFilesTest < Redmine::RoutingTest
21 def test_files
21 def test_files
22 assert_routing(
22 should_route 'GET /projects/foo/files' => 'files#index', :project_id => 'foo'
23 { :method => 'get', :path => "/projects/33/files" },
23 should_route 'GET /projects/foo/files/new' => 'files#new', :project_id => 'foo'
24 { :controller => 'files', :action => 'index', :project_id => '33' }
24 should_route 'POST /projects/foo/files' => 'files#create', :project_id => 'foo'
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/33/files/new" },
28 { :controller => 'files', :action => 'new', :project_id => '33' }
29 )
30 assert_routing(
31 { :method => 'post', :path => "/projects/33/files" },
32 { :controller => 'files', :action => 'create', :project_id => '33' }
33 )
34 end
25 end
35 end
26 end
@@ -17,25 +17,12
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingGanttsTest < ActionDispatch::IntegrationTest
20 class RoutingGanttsTest < Redmine::RoutingTest
21 def test_gantts
21 def test_gantts
22 assert_routing(
22 should_route 'GET /issues/gantt' => 'gantts#show'
23 { :method => 'get', :path => "/issues/gantt" },
23 should_route 'GET /issues/gantt.pdf' => 'gantts#show', :format => 'pdf'
24 { :controller => 'gantts', :action => 'show' }
24
25 )
25 should_route 'GET /projects/foo/issues/gantt' => 'gantts#show', :project_id => 'foo'
26 assert_routing(
26 should_route 'GET /projects/foo/issues/gantt.pdf' => 'gantts#show', :project_id => 'foo', :format => 'pdf'
27 { :method => 'get', :path => "/issues/gantt.pdf" },
28 { :controller => 'gantts', :action => 'show', :format => 'pdf' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects/project-name/issues/gantt" },
32 { :controller => 'gantts', :action => 'show',
33 :project_id => 'project-name' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" },
37 { :controller => 'gantts', :action => 'show',
38 :project_id => 'project-name', :format => 'pdf' }
39 )
40 end
27 end
41 end
28 end
@@ -17,58 +17,24
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingGroupsTest < ActionDispatch::IntegrationTest
20 class RoutingGroupsTest < Redmine::RoutingTest
21 def test_groups_resources
21 def test_groups
22 assert_routing(
22 should_route 'GET /groups' => 'groups#index'
23 { :method => 'get', :path => "/groups" },
23 should_route 'GET /groups/new' => 'groups#new'
24 { :controller => 'groups', :action => 'index' }
24 should_route 'POST /groups' => 'groups#create'
25 )
25
26 assert_routing(
26 should_route 'GET /groups/1' => 'groups#show', :id => '1'
27 { :method => 'post', :path => "/groups" },
27 should_route 'GET /groups/1/edit' => 'groups#edit', :id => '1'
28 { :controller => 'groups', :action => 'create' }
28 should_route 'PUT /groups/1' => 'groups#update', :id => '1'
29 )
29 should_route 'DELETE /groups/1' => 'groups#destroy', :id => '1'
30 assert_routing(
30
31 { :method => 'get', :path => "/groups/new" },
31 should_route 'GET /groups/1/autocomplete_for_user' => 'groups#autocomplete_for_user', :id => '1'
32 { :controller => 'groups', :action => 'new' }
32 should_route 'GET /groups/1/autocomplete_for_user.js' => 'groups#autocomplete_for_user', :id => '1', :format => 'js'
33 )
34 assert_routing(
35 { :method => 'get', :path => "/groups/1/edit" },
36 { :controller => 'groups', :action => 'edit', :id => '1' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/groups/1/autocomplete_for_user" },
40 { :controller => 'groups', :action => 'autocomplete_for_user', :id => '1' }
41 )
42 assert_routing(
43 { :method => 'get', :path => "/groups/1/autocomplete_for_user.js" },
44 { :controller => 'groups', :action => 'autocomplete_for_user', :id => '1', :format => 'js' }
45 )
46 assert_routing(
47 { :method => 'get', :path => "/groups/1" },
48 { :controller => 'groups', :action => 'show', :id => '1' }
49 )
50 assert_routing(
51 { :method => 'put', :path => "/groups/1" },
52 { :controller => 'groups', :action => 'update', :id => '1' }
53 )
54 assert_routing(
55 { :method => 'delete', :path => "/groups/1" },
56 { :controller => 'groups', :action => 'destroy', :id => '1' }
57 )
58 end
33 end
59
34
60 def test_groups
35 def test_group_users
61 assert_routing(
36 should_route 'GET /groups/567/users/new' => 'groups#new_users', :id => '567'
62 { :method => 'get', :path => "/groups/567/users/new" },
37 should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567'
63 { :controller => 'groups', :action => 'new_users', :id => '567' }
38 should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12'
64 )
65 assert_routing(
66 { :method => 'post', :path => "/groups/567/users" },
67 { :controller => 'groups', :action => 'add_users', :id => '567' }
68 )
69 assert_routing(
70 { :method => 'delete', :path => "/groups/567/users/12" },
71 { :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' }
72 )
73 end
39 end
74 end
40 end
@@ -17,41 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingIssueCategoriesTest < ActionDispatch::IntegrationTest
20 class RoutingIssueCategoriesTest < Redmine::RoutingTest
21 def test_issue_categories_scoped_under_project
21 def test_issue_categories_scoped_under_project
22 assert_routing(
22 should_route 'GET /projects/foo/issue_categories' => 'issue_categories#index', :project_id => 'foo'
23 { :method => 'get', :path => "/projects/foo/issue_categories" },
23 should_route 'GET /projects/foo/issue_categories/new' => 'issue_categories#new', :project_id => 'foo'
24 { :controller => 'issue_categories', :action => 'index',
24 should_route 'POST /projects/foo/issue_categories' => 'issue_categories#create', :project_id => 'foo'
25 :project_id => 'foo' }
26 )
27 assert_routing(
28 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
29 { :controller => 'issue_categories', :action => 'new',
30 :project_id => 'foo' }
31 )
32 assert_routing(
33 { :method => 'post', :path => "/projects/foo/issue_categories" },
34 { :controller => 'issue_categories', :action => 'create',
35 :project_id => 'foo' }
36 )
37 end
25 end
38
26
39 def test_issue_categories
27 def test_issue_categories
40 assert_routing(
28 should_route 'GET /issue_categories/1/edit' => 'issue_categories#edit', :id => '1'
41 { :method => 'get', :path => "/issue_categories/1" },
29 should_route 'PUT /issue_categories/1' => 'issue_categories#update', :id => '1'
42 { :controller => 'issue_categories', :action => 'show', :id => '1' }
30 should_route 'DELETE /issue_categories/1' => 'issue_categories#destroy', :id => '1'
43 )
44 assert_routing(
45 { :method => 'get', :path => "/issue_categories/1/edit" },
46 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
47 )
48 assert_routing(
49 { :method => 'put', :path => "/issue_categories/1" },
50 { :controller => 'issue_categories', :action => 'update', :id => '1' }
51 )
52 assert_routing(
53 { :method => 'delete', :path => "/issue_categories/1" },
54 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
55 )
56 end
31 end
57 end
32 end
@@ -17,25 +17,11
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingIssueRelationsTest < ActionDispatch::IntegrationTest
20 class RoutingIssueRelationsTest < Redmine::RoutingTest
21 def test_issue_relations
21 def test_issue_relations
22 assert_routing(
22 should_route 'GET /issues/1/relations' => 'issue_relations#index', :issue_id => '1'
23 { :method => 'get', :path => "/issues/1/relations" },
23 should_route 'POST /issues/1/relations' => 'issue_relations#create', :issue_id => '1'
24 { :controller => 'issue_relations', :action => 'index',
24
25 :issue_id => '1' }
25 should_route 'DELETE /relations/23' => 'issue_relations#destroy', :id => '23'
26 )
27 assert_routing(
28 { :method => 'post', :path => "/issues/1/relations" },
29 { :controller => 'issue_relations', :action => 'create',
30 :issue_id => '1' }
31 )
32 assert_routing(
33 { :method => 'get', :path => "/relations/23" },
34 { :controller => 'issue_relations', :action => 'show', :id => '23' }
35 )
36 assert_routing(
37 { :method => 'delete', :path => "/relations/23" },
38 { :controller => 'issue_relations', :action => 'destroy', :id => '23' }
39 )
40 end
26 end
41 end
27 end
@@ -17,37 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingIssueStatusesTest < ActionDispatch::IntegrationTest
20 class RoutingIssueStatusesTest < Redmine::RoutingTest
21 def test_issue_statuses
21 def test_issue_statuses
22 assert_routing(
22 should_route 'GET /issue_statuses' => 'issue_statuses#index'
23 { :method => 'get', :path => "/issue_statuses" },
23 should_route 'POST /issue_statuses' => 'issue_statuses#create'
24 { :controller => 'issue_statuses', :action => 'index' }
24 should_route 'GET /issue_statuses/new' => 'issue_statuses#new'
25 )
25
26 assert_routing(
26 should_route 'GET /issue_statuses/1/edit' => 'issue_statuses#edit', :id => '1'
27 { :method => 'post', :path => "/issue_statuses" },
27 should_route 'PUT /issue_statuses/1' => 'issue_statuses#update', :id => '1'
28 { :controller => 'issue_statuses', :action => 'create' }
28 should_route 'DELETE /issue_statuses/1' => 'issue_statuses#destroy', :id => '1'
29 )
29
30 assert_routing(
30 should_route 'POST /issue_statuses/update_issue_done_ratio' => 'issue_statuses#update_issue_done_ratio'
31 { :method => 'get', :path => "/issue_statuses/new" },
32 { :controller => 'issue_statuses', :action => 'new' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/issue_statuses/1/edit" },
36 { :controller => 'issue_statuses', :action => 'edit', :id => '1' }
37 )
38 assert_routing(
39 { :method => 'put', :path => "/issue_statuses/1" },
40 { :controller => 'issue_statuses', :action => 'update',
41 :id => '1' }
42 )
43 assert_routing(
44 { :method => 'delete', :path => "/issue_statuses/1" },
45 { :controller => 'issue_statuses', :action => 'destroy',
46 :id => '1' }
47 )
48 assert_routing(
49 { :method => 'post', :path => "/issue_statuses/update_issue_done_ratio" },
50 { :controller => 'issue_statuses', :action => 'update_issue_done_ratio' }
51 )
52 end
31 end
53 end
32 end
@@ -17,98 +17,40
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingIssuesTest < ActionDispatch::IntegrationTest
20 class RoutingIssuesTest < Redmine::RoutingTest
21 def test_issues
21 def test_issues
22 assert_routing(
22 should_route 'GET /issues' => 'issues#index'
23 { :method => 'get', :path => "/issues" },
23 should_route 'GET /issues.pdf' => 'issues#index', :format => 'pdf'
24 { :controller => 'issues', :action => 'index' }
24 should_route 'GET /issues.atom' => 'issues#index', :format => 'atom'
25 )
25
26 assert_routing(
26 should_route 'GET /issues/64' => 'issues#show', :id => '64'
27 { :method => 'get', :path => "/issues.pdf" },
27 should_route 'GET /issues/64.pdf' => 'issues#show', :id => '64', :format => 'pdf'
28 { :controller => 'issues', :action => 'index', :format => 'pdf' }
28 should_route 'GET /issues/64.atom' => 'issues#show', :id => '64', :format => 'atom'
29 )
29
30 assert_routing(
30 should_route 'GET /issues/64/edit' => 'issues#edit', :id => '64'
31 { :method => 'get', :path => "/issues.atom" },
31 should_route 'PUT /issues/64' => 'issues#update', :id => '64'
32 { :controller => 'issues', :action => 'index', :format => 'atom' }
32 should_route 'DELETE /issues/64' => 'issues#destroy', :id => '64'
33 )
34 assert_routing(
35 { :method => 'get', :path => "/issues/64" },
36 { :controller => 'issues', :action => 'show', :id => '64' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/issues/64.pdf" },
40 { :controller => 'issues', :action => 'show', :id => '64',
41 :format => 'pdf' }
42 )
43 assert_routing(
44 { :method => 'get', :path => "/issues/64.atom" },
45 { :controller => 'issues', :action => 'show', :id => '64',
46 :format => 'atom' }
47 )
48 assert_routing(
49 { :method => 'get', :path => "/issues/64/edit" },
50 { :controller => 'issues', :action => 'edit', :id => '64' }
51 )
52 assert_routing(
53 { :method => 'put', :path => "/issues/1" },
54 { :controller => 'issues', :action => 'update', :id => '1' }
55 )
56 assert_routing(
57 { :method => 'delete', :path => "/issues/1" },
58 { :controller => 'issues', :action => 'destroy', :id => '1' }
59 )
60 end
33 end
61
34
62 def test_issues_scoped_under_project
35 def test_issues_bulk_edit
63 assert_routing(
36 should_route 'GET /issues/bulk_edit' => 'issues#bulk_edit'
64 { :method => 'get', :path => "/projects/23/issues" },
37 should_route 'POST /issues/bulk_edit' => 'issues#bulk_edit' # For updating the bulk edit form
65 { :controller => 'issues', :action => 'index', :project_id => '23' }
38 should_route 'POST /issues/bulk_update' => 'issues#bulk_update'
66 )
67 assert_routing(
68 { :method => 'get', :path => "/projects/23/issues.pdf" },
69 { :controller => 'issues', :action => 'index', :project_id => '23',
70 :format => 'pdf' }
71 )
72 assert_routing(
73 { :method => 'get', :path => "/projects/23/issues.atom" },
74 { :controller => 'issues', :action => 'index', :project_id => '23',
75 :format => 'atom' }
76 )
77 assert_routing(
78 { :method => 'post', :path => "/projects/23/issues" },
79 { :controller => 'issues', :action => 'create', :project_id => '23' }
80 )
81 assert_routing(
82 { :method => 'get', :path => "/projects/23/issues/new" },
83 { :controller => 'issues', :action => 'new', :project_id => '23' }
84 )
85 end
39 end
86
40
87 def test_issues_form_update
41 def test_issues_scoped_under_project
88 ["post", "put"].each do |method|
42 should_route 'GET /projects/23/issues' => 'issues#index', :project_id => '23'
89 assert_routing(
43 should_route 'GET /projects/23/issues.pdf' => 'issues#index', :project_id => '23', :format => 'pdf'
90 { :method => method, :path => "/projects/23/issues/update_form" },
44 should_route 'GET /projects/23/issues.atom' => 'issues#index', :project_id => '23', :format => 'atom'
91 { :controller => 'issues', :action => 'update_form', :project_id => '23' }
45
92 )
46 should_route 'GET /projects/23/issues/new' => 'issues#new', :project_id => '23'
93 end
47 should_route 'POST /projects/23/issues' => 'issues#create', :project_id => '23'
48
49 should_route 'GET /projects/23/issues/64/copy' => 'issues#new', :project_id => '23', :copy_from => '64'
94 end
50 end
95
51
96 def test_issues_extra_actions
52 def test_issues_form_update
97 assert_routing(
53 should_route 'POST /projects/23/issues/update_form' => 'issues#update_form', :project_id => '23'
98 { :method => 'get', :path => "/projects/23/issues/64/copy" },
54 should_route 'PUT /projects/23/issues/update_form' => 'issues#update_form', :project_id => '23'
99 { :controller => 'issues', :action => 'new', :project_id => '23',
100 :copy_from => '64' }
101 )
102 # For updating the bulk edit form
103 ["get", "post"].each do |method|
104 assert_routing(
105 { :method => method, :path => "/issues/bulk_edit" },
106 { :controller => 'issues', :action => 'bulk_edit' }
107 )
108 end
109 assert_routing(
110 { :method => 'post', :path => "/issues/bulk_update" },
111 { :controller => 'issues', :action => 'bulk_update' }
112 )
113 end
55 end
114 end
56 end
@@ -17,25 +17,13
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingJournalsTest < ActionDispatch::IntegrationTest
20 class RoutingJournalsTest < Redmine::RoutingTest
21 def test_journals
21 def test_journals
22 assert_routing(
22 should_route 'POST /issues/1/quoted' => 'journals#new', :id => '1'
23 { :method => 'post', :path => "/issues/1/quoted" },
23 should_route 'GET /issues/changes' => 'journals#index'
24 { :controller => 'journals', :action => 'new', :id => '1' }
24 should_route 'GET /journals/diff/1' => 'journals#diff', :id => '1'
25 )
25
26 assert_routing(
26 should_route 'GET /journals/edit/1' => 'journals#edit', :id => '1'
27 { :method => 'get', :path => "/issues/changes" },
27 should_route 'POST /journals/edit/1' => 'journals#edit', :id => '1'
28 { :controller => 'journals', :action => 'index' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/journals/diff/1" },
32 { :controller => 'journals', :action => 'diff', :id => '1' }
33 )
34 ["get", "post"].each do |method|
35 assert_routing(
36 { :method => method, :path => "/journals/edit/1" },
37 { :controller => 'journals', :action => 'edit', :id => '1' }
38 )
39 end
40 end
28 end
41 end
29 end
@@ -17,11 +17,8
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingMailHandlerTest < ActionDispatch::IntegrationTest
20 class RoutingMailHandlerTest < Redmine::RoutingTest
21 def test_mail_handler
21 def test_mail_handler
22 assert_routing(
22 should_route 'POST /mail_handler' => 'mail_handler#index'
23 { :method => "post", :path => "/mail_handler" },
24 { :controller => 'mail_handler', :action => 'index' }
25 )
26 end
23 end
27 end
24 end
@@ -17,31 +17,15
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingMembersTest < ActionDispatch::IntegrationTest
20 class RoutingMembersTest < Redmine::RoutingTest
21 def test_members
21 def test_members
22 assert_routing(
22 should_route 'GET /projects/foo/memberships/new' => 'members#new', :project_id => 'foo'
23 { :method => 'post', :path => "/projects/5234/memberships" },
23 should_route 'POST /projects/foo/memberships' => 'members#create', :project_id => 'foo'
24 { :controller => 'members', :action => 'create', :project_id => '5234' }
24
25 )
25 should_route 'PUT /memberships/5234' => 'members#update', :id => '5234'
26 assert_routing(
26 should_route 'DELETE /memberships/5234' => 'members#destroy', :id => '5234'
27 { :method => 'get', :path => "/projects/5234/memberships/new" },
27
28 { :controller => 'members', :action => 'new', :project_id => '5234' }
28 should_route 'GET /projects/foo/memberships/autocomplete' => 'members#autocomplete', :project_id => 'foo'
29 )
29 should_route 'GET /projects/foo/memberships/autocomplete.js' => 'members#autocomplete', :project_id => 'foo', :format => 'js'
30 assert_routing(
31 { :method => 'put', :path => "/memberships/5234" },
32 { :controller => 'members', :action => 'update', :id => '5234' }
33 )
34 assert_routing(
35 { :method => 'delete', :path => "/memberships/5234" },
36 { :controller => 'members', :action => 'destroy', :id => '5234' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/projects/5234/memberships/autocomplete" },
40 { :controller => 'members', :action => 'autocomplete', :project_id => '5234' }
41 )
42 assert_routing(
43 { :method => 'get', :path => "/projects/5234/memberships/autocomplete.js" },
44 { :controller => 'members', :action => 'autocomplete', :project_id => '5234', :format => 'js' }
45 )
46 end
30 end
47 end
31 end
@@ -17,50 +17,17
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingMessagesTest < ActionDispatch::IntegrationTest
20 class RoutingMessagesTest < Redmine::RoutingTest
21 def test_messages
21 def test_messages
22 assert_routing(
22 # TODO: refactor routes
23 { :method => 'get', :path => "/boards/22/topics/2" },
23 should_route 'GET /boards/22/topics/new' => 'messages#new', :board_id => '22'
24 { :controller => 'messages', :action => 'show', :id => '2',
24 should_route 'POST /boards/22/topics/new' => 'messages#new', :board_id => '22'
25 :board_id => '22' }
25 should_route 'POST /boards/22/topics/preview' => 'messages#preview', :board_id => '22'
26 )
26
27 assert_routing(
27 should_route 'GET /boards/22/topics/2' => 'messages#show', :id => '2', :board_id => '22'
28 { :method => 'get', :path => "/boards/lala/topics/new" },
28 should_route 'GET /boards/22/topics/2/edit' => 'messages#edit', :id => '2', :board_id => '22'
29 { :controller => 'messages', :action => 'new', :board_id => 'lala' }
29 should_route 'POST /boards/22/topics/quote/2' => 'messages#quote', :id => '2', :board_id => '22'
30 )
30 should_route 'POST /boards/22/topics/2/replies' => 'messages#reply', :id => '2', :board_id => '22'
31 assert_routing(
31 should_route 'POST /boards/22/topics/2/destroy' => 'messages#destroy', :id => '2', :board_id => '22'
32 { :method => 'get', :path => "/boards/lala/topics/22/edit" },
33 { :controller => 'messages', :action => 'edit', :id => '22',
34 :board_id => 'lala' }
35 )
36 assert_routing(
37 { :method => 'post', :path => "/boards/lala/topics/quote/22" },
38 { :controller => 'messages', :action => 'quote', :id => '22',
39 :board_id => 'lala' }
40 )
41 assert_routing(
42 { :method => 'post', :path => "/boards/lala/topics/new" },
43 { :controller => 'messages', :action => 'new', :board_id => 'lala' }
44 )
45 assert_routing(
46 { :method => 'post', :path => "/boards/lala/topics/preview" },
47 { :controller => 'messages', :action => 'preview',
48 :board_id => 'lala' }
49 )
50 assert_routing(
51 { :method => 'post', :path => "/boards/lala/topics/22/edit" },
52 { :controller => 'messages', :action => 'edit', :id => '22',
53 :board_id => 'lala' }
54 )
55 assert_routing(
56 { :method => 'post', :path => "/boards/22/topics/555/replies" },
57 { :controller => 'messages', :action => 'reply', :id => '555',
58 :board_id => '22' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/boards/22/topics/555/destroy" },
62 { :controller => 'messages', :action => 'destroy', :id => '555',
63 :board_id => '22' }
64 )
65 end
32 end
66 end
33 end
@@ -17,57 +17,26
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingMyTest < ActionDispatch::IntegrationTest
20 class RoutingMyTest < Redmine::RoutingTest
21 def test_my
21 def test_my
22 ["get", "post"].each do |method|
22 should_route 'GET /my/account' => 'my#account'
23 assert_routing(
23 should_route 'POST /my/account' => 'my#account'
24 { :method => method, :path => "/my/account" },
24
25 { :controller => 'my', :action => 'account' }
25 should_route 'GET /my/account/destroy' => 'my#destroy'
26 )
26 should_route 'POST /my/account/destroy' => 'my#destroy'
27 end
27
28 ["get", "post"].each do |method|
28 should_route 'GET /my/page' => 'my#page'
29 assert_routing(
29 should_route 'GET /my' => 'my#index'
30 { :method => method, :path => "/my/account/destroy" },
30
31 { :controller => 'my', :action => 'destroy' }
31 should_route 'POST /my/reset_rss_key' => 'my#reset_rss_key'
32 )
32 should_route 'POST /my/reset_api_key' => 'my#reset_api_key'
33 end
33
34 assert_routing(
34 should_route 'GET /my/password' => 'my#password'
35 { :method => 'get', :path => "/my/page" },
35 should_route 'POST /my/password' => 'my#password'
36 { :controller => 'my', :action => 'page' }
36
37 )
37 should_route 'GET /my/page_layout' => 'my#page_layout'
38 assert_routing(
38 should_route 'POST /my/add_block' => 'my#add_block'
39 { :method => 'get', :path => "/my" },
39 should_route 'POST /my/remove_block' => 'my#remove_block'
40 { :controller => 'my', :action => 'index' }
40 should_route 'POST /my/order_blocks' => 'my#order_blocks'
41 )
42 assert_routing(
43 { :method => 'post', :path => "/my/reset_rss_key" },
44 { :controller => 'my', :action => 'reset_rss_key' }
45 )
46 assert_routing(
47 { :method => 'post', :path => "/my/reset_api_key" },
48 { :controller => 'my', :action => 'reset_api_key' }
49 )
50 ["get", "post"].each do |method|
51 assert_routing(
52 { :method => method, :path => "/my/password" },
53 { :controller => 'my', :action => 'password' }
54 )
55 end
56 assert_routing(
57 { :method => 'get', :path => "/my/page_layout" },
58 { :controller => 'my', :action => 'page_layout' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/my/add_block" },
62 { :controller => 'my', :action => 'add_block' }
63 )
64 assert_routing(
65 { :method => 'post', :path => "/my/remove_block" },
66 { :controller => 'my', :action => 'remove_block' }
67 )
68 assert_routing(
69 { :method => 'post', :path => "/my/order_blocks" },
70 { :controller => 'my', :action => 'order_blocks' }
71 )
72 end
41 end
73 end
42 end
@@ -17,58 +17,20
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingNewsTest < ActionDispatch::IntegrationTest
20 class RoutingNewsTest < Redmine::RoutingTest
21 def test_news_index
21 def test_news_scoped_under_project
22 assert_routing(
22 should_route 'GET /projects/foo/news' => 'news#index', :project_id => 'foo'
23 { :method => 'get', :path => "/news" },
23 should_route 'GET /projects/foo/news.atom' => 'news#index', :project_id => 'foo', :format => 'atom'
24 { :controller => 'news', :action => 'index' }
24 should_route 'GET /projects/foo/news/new' => 'news#new', :project_id => 'foo'
25 )
25 should_route 'POST /projects/foo/news' => 'news#create', :project_id => 'foo'
26 assert_routing(
27 { :method => 'get', :path => "/news.atom" },
28 { :controller => 'news', :action => 'index', :format => 'atom' }
29 )
30 end
26 end
31
27
32 def test_news
28 def test_news
33 assert_routing(
29 should_route 'GET /news' => 'news#index'
34 { :method => 'get', :path => "/news/2" },
30 should_route 'GET /news.atom' => 'news#index', :format => 'atom'
35 { :controller => 'news', :action => 'show', :id => '2' }
31 should_route 'GET /news/2' => 'news#show', :id => '2'
36 )
32 should_route 'GET /news/2/edit' => 'news#edit', :id => '2'
37 assert_routing(
33 should_route 'PUT /news/2' => 'news#update', :id => '2'
38 { :method => 'get', :path => "/news/234" },
34 should_route 'DELETE /news/2' => 'news#destroy', :id => '2'
39 { :controller => 'news', :action => 'show', :id => '234' }
40 )
41 assert_routing(
42 { :method => 'get', :path => "/news/567/edit" },
43 { :controller => 'news', :action => 'edit', :id => '567' }
44 )
45 assert_routing(
46 { :method => 'put', :path => "/news/567" },
47 { :controller => 'news', :action => 'update', :id => '567' }
48 )
49 assert_routing(
50 { :method => 'delete', :path => "/news/567" },
51 { :controller => 'news', :action => 'destroy', :id => '567' }
52 )
53 end
54
55 def test_news_scoped_under_project
56 assert_routing(
57 { :method => 'get', :path => "/projects/567/news" },
58 { :controller => 'news', :action => 'index', :project_id => '567' }
59 )
60 assert_routing(
61 { :method => 'get', :path => "/projects/567/news.atom" },
62 { :controller => 'news', :action => 'index', :format => 'atom',
63 :project_id => '567' }
64 )
65 assert_routing(
66 { :method => 'get', :path => "/projects/567/news/new" },
67 { :controller => 'news', :action => 'new', :project_id => '567' }
68 )
69 assert_routing(
70 { :method => 'post', :path => "/projects/567/news" },
71 { :controller => 'news', :action => 'create', :project_id => '567' }
72 )
73 end
35 end
74 end
36 end
@@ -17,21 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingPreviewsTest < ActionDispatch::IntegrationTest
20 class RoutingPreviewsTest < Redmine::RoutingTest
21 def test_previews
21 def test_previews
22 ["get", "post", "put"].each do |method|
22 should_route 'GET /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
23 assert_routing(
23 should_route 'PUT /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
24 { :method => method, :path => "/issues/preview/new/123" },
24 should_route 'POST /issues/preview/new/foo' => 'previews#issue', :project_id => 'foo'
25 { :controller => 'previews', :action => 'issue', :project_id => '123' }
25
26 )
26 should_route 'GET /issues/preview/edit/321' => 'previews#issue', :id => '321'
27 assert_routing(
27 should_route 'PUT /issues/preview/edit/321' => 'previews#issue', :id => '321'
28 { :method => method, :path => "/issues/preview/edit/321" },
28 should_route 'POST /issues/preview/edit/321' => 'previews#issue', :id => '321'
29 { :controller => 'previews', :action => 'issue', :id => '321' }
29
30 )
30 should_route 'GET /news/preview' => 'previews#news'
31 end
32 assert_routing(
33 { :method => 'get', :path => "/news/preview" },
34 { :controller => 'previews', :action => 'news' }
35 )
36 end
31 end
37 end
32 end
@@ -17,50 +17,18
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingPrincipalMembershipsTest < ActionDispatch::IntegrationTest
20 class RoutingPrincipalMembershipsTest < Redmine::RoutingTest
21 def test_user_memberships
21 def test_user_memberships
22 assert_routing(
22 should_route 'GET /users/123/memberships/new' => 'principal_memberships#new', :user_id => '123'
23 { :method => 'get', :path => "/users/123/memberships/new" },
23 should_route 'POST /users/123/memberships' => 'principal_memberships#create', :user_id => '123'
24 { :controller => 'principal_memberships', :action => 'new',
24 should_route 'PUT /users/123/memberships/55' => 'principal_memberships#update', :user_id => '123', :id => '55'
25 :user_id => '123' }
25 should_route 'DELETE /users/123/memberships/55' => 'principal_memberships#destroy', :user_id => '123', :id => '55'
26 )
27 assert_routing(
28 { :method => 'post', :path => "/users/123/memberships" },
29 { :controller => 'principal_memberships', :action => 'create',
30 :user_id => '123' }
31 )
32 assert_routing(
33 { :method => 'put', :path => "/users/123/memberships/55" },
34 { :controller => 'principal_memberships', :action => 'update',
35 :user_id => '123', :id => '55' }
36 )
37 assert_routing(
38 { :method => 'delete', :path => "/users/123/memberships/55" },
39 { :controller => 'principal_memberships', :action => 'destroy',
40 :user_id => '123', :id => '55' }
41 )
42 end
26 end
43
27
44 def test_group_memberships
28 def test_group_memberships
45 assert_routing(
29 should_route 'GET /groups/123/memberships/new' => 'principal_memberships#new', :group_id => '123'
46 { :method => 'get', :path => "/groups/123/memberships/new" },
30 should_route 'POST /groups/123/memberships' => 'principal_memberships#create', :group_id => '123'
47 { :controller => 'principal_memberships', :action => 'new',
31 should_route 'PUT /groups/123/memberships/55' => 'principal_memberships#update', :group_id => '123', :id => '55'
48 :group_id => '123' }
32 should_route 'DELETE /groups/123/memberships/55' => 'principal_memberships#destroy', :group_id => '123', :id => '55'
49 )
50 assert_routing(
51 { :method => 'post', :path => "/groups/123/memberships" },
52 { :controller => 'principal_memberships', :action => 'create',
53 :group_id => '123' }
54 )
55 assert_routing(
56 { :method => 'put', :path => "/groups/123/memberships/55" },
57 { :controller => 'principal_memberships', :action => 'update',
58 :group_id => '123', :id => '55' }
59 )
60 assert_routing(
61 { :method => 'delete', :path => "/groups/123/memberships/55" },
62 { :controller => 'principal_memberships', :action => 'destroy',
63 :group_id => '123', :id => '55' }
64 )
65 end
33 end
66 end
34 end
@@ -17,17 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingProjectEnumerationsTest < ActionDispatch::IntegrationTest
20 class RoutingProjectEnumerationsTest < Redmine::RoutingTest
21 def test_project_enumerations
21 def test_project_enumerations
22 assert_routing(
22 should_route 'PUT /projects/foo/enumerations' => 'project_enumerations#update', :project_id => 'foo'
23 { :method => 'put', :path => "/projects/64/enumerations" },
23 should_route 'DELETE /projects/foo/enumerations' => 'project_enumerations#destroy', :project_id => 'foo'
24 { :controller => 'project_enumerations', :action => 'update',
25 :project_id => '64' }
26 )
27 assert_routing(
28 { :method => 'delete', :path => "/projects/64/enumerations" },
29 { :controller => 'project_enumerations', :action => 'destroy',
30 :project_id => '64' }
31 )
32 end
24 end
33 end
25 end
@@ -17,60 +17,23
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingProjectsTest < ActionDispatch::IntegrationTest
20 class RoutingProjectsTest < Redmine::RoutingTest
21 def test_projects
21 def test_projects
22 assert_routing(
22 should_route 'GET /projects' => 'projects#index'
23 { :method => 'get', :path => "/projects" },
23 should_route 'GET /projects.atom' => 'projects#index', :format => 'atom'
24 { :controller => 'projects', :action => 'index' }
24 should_route 'GET /projects/new' => 'projects#new'
25 )
25 should_route 'POST /projects' => 'projects#create'
26 assert_routing(
26
27 { :method => 'get', :path => "/projects.atom" },
27 should_route 'GET /projects/foo' => 'projects#show', :id => 'foo'
28 { :controller => 'projects', :action => 'index', :format => 'atom' }
28 should_route 'PUT /projects/foo' => 'projects#update', :id => 'foo'
29 )
29 should_route 'DELETE /projects/foo' => 'projects#destroy', :id => 'foo'
30 assert_routing(
30
31 { :method => 'get', :path => "/projects/new" },
31 should_route 'GET /projects/foo/settings' => 'projects#settings', :id => 'foo'
32 { :controller => 'projects', :action => 'new' }
32 should_route 'GET /projects/foo/settings/members' => 'projects#settings', :id => 'foo', :tab => 'members'
33 )
33
34 assert_routing(
34 should_route 'POST /projects/foo/archive' => 'projects#archive', :id => 'foo'
35 { :method => 'get', :path => "/projects/test" },
35 should_route 'POST /projects/foo/unarchive' => 'projects#unarchive', :id => 'foo'
36 { :controller => 'projects', :action => 'show', :id => 'test' }
36 should_route 'POST /projects/foo/close' => 'projects#close', :id => 'foo'
37 )
37 should_route 'POST /projects/foo/reopen' => 'projects#reopen', :id => 'foo'
38 assert_routing(
39 { :method => 'get', :path => "/projects/4223/settings" },
40 { :controller => 'projects', :action => 'settings', :id => '4223' }
41 )
42 assert_routing(
43 { :method => 'get', :path => "/projects/4223/settings/members" },
44 { :controller => 'projects', :action => 'settings', :id => '4223',
45 :tab => 'members' }
46 )
47 assert_routing(
48 { :method => 'post', :path => "/projects" },
49 { :controller => 'projects', :action => 'create' }
50 )
51 assert_routing(
52 { :method => 'post', :path => "/projects/64/archive" },
53 { :controller => 'projects', :action => 'archive', :id => '64' }
54 )
55 assert_routing(
56 { :method => 'post', :path => "/projects/64/unarchive" },
57 { :controller => 'projects', :action => 'unarchive', :id => '64' }
58 )
59 assert_routing(
60 { :method => 'post', :path => "/projects/64/close" },
61 { :controller => 'projects', :action => 'close', :id => '64' }
62 )
63 assert_routing(
64 { :method => 'post', :path => "/projects/64/reopen" },
65 { :controller => 'projects', :action => 'reopen', :id => '64' }
66 )
67 assert_routing(
68 { :method => 'put', :path => "/projects/4223" },
69 { :controller => 'projects', :action => 'update', :id => '4223' }
70 )
71 assert_routing(
72 { :method => 'delete', :path => "/projects/64" },
73 { :controller => 'projects', :action => 'destroy', :id => '64' }
74 )
75 end
38 end
76 end
39 end
@@ -17,38 +17,18
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingQueriesTest < ActionDispatch::IntegrationTest
20 class RoutingQueriesTest < Redmine::RoutingTest
21 def test_queries
21 def test_queries
22 assert_routing(
22 should_route 'GET /queries/new' => 'queries#new'
23 { :method => 'get', :path => "/queries/new" },
23 should_route 'POST /queries' => 'queries#create'
24 { :controller => 'queries', :action => 'new' }
24
25 )
25 should_route 'GET /queries/1/edit' => 'queries#edit', :id => '1'
26 assert_routing(
26 should_route 'PUT /queries/1' => 'queries#update', :id => '1'
27 { :method => 'post', :path => "/queries" },
27 should_route 'DELETE /queries/1' => 'queries#destroy', :id => '1'
28 { :controller => 'queries', :action => 'create' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/queries/1/edit" },
32 { :controller => 'queries', :action => 'edit', :id => '1' }
33 )
34 assert_routing(
35 { :method => 'put', :path => "/queries/1" },
36 { :controller => 'queries', :action => 'update', :id => '1' }
37 )
38 assert_routing(
39 { :method => 'delete', :path => "/queries/1" },
40 { :controller => 'queries', :action => 'destroy', :id => '1' }
41 )
42 end
28 end
43
29
44 def test_queries_scoped_under_project
30 def test_queries_scoped_under_project
45 assert_routing(
31 should_route 'GET /projects/foo/queries/new' => 'queries#new', :project_id => 'foo'
46 { :method => 'get', :path => "/projects/redmine/queries/new" },
32 should_route 'POST /projects/foo/queries' => 'queries#create', :project_id => 'foo'
47 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
48 )
49 assert_routing(
50 { :method => 'post', :path => "/projects/redmine/queries" },
51 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
52 )
53 end
33 end
54 end
34 end
@@ -17,16 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingReportsTest < ActionDispatch::IntegrationTest
20 class RoutingReportsTest < Redmine::RoutingTest
21 def test_reports
21 def test_reports
22 assert_routing(
22 should_route 'GET /projects/foo/issues/report' => 'reports#issue_report', :id => 'foo'
23 { :method => 'get', :path => "/projects/567/issues/report" },
23 should_route 'GET /projects/foo/issues/report/assigned_to' => 'reports#issue_report_details', :id => 'foo', :detail => 'assigned_to'
24 { :controller => 'reports', :action => 'issue_report', :id => '567' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/567/issues/report/assigned_to" },
28 { :controller => 'reports', :action => 'issue_report_details',
29 :id => '567', :detail => 'assigned_to' }
30 )
31 end
24 end
32 end
25 end
@@ -17,7 +17,7
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingRepositoriesTest < ActionDispatch::IntegrationTest
20 class RoutingRepositoriesTest < Redmine::RoutingTest
21 def setup
21 def setup
22 @path_hash = repository_path_hash(%w[path to file.c])
22 @path_hash = repository_path_hash(%w[path to file.c])
23 assert_equal "path/to/file.c", @path_hash[:path]
23 assert_equal "path/to/file.c", @path_hash[:path]
@@ -25,407 +25,115 class RoutingRepositoriesTest < ActionDispatch::IntegrationTest
25 end
25 end
26
26
27 def test_repositories_resources
27 def test_repositories_resources
28 assert_routing(
28 should_route 'GET /projects/foo/repositories/new' => 'repositories#new', :project_id => 'foo'
29 { :method => 'get',
29 should_route 'POST /projects/foo/repositories' => 'repositories#create', :project_id => 'foo'
30 :path => "/projects/redmine/repositories/new" },
30 should_route 'GET /repositories/1/edit' => 'repositories#edit', :id => '1'
31 { :controller => 'repositories', :action => 'new', :project_id => 'redmine' }
31 should_route 'PUT /repositories/1' => 'repositories#update', :id => '1'
32 )
32 should_route 'DELETE /repositories/1' => 'repositories#destroy', :id => '1'
33 assert_routing(
34 { :method => 'post',
35 :path => "/projects/redmine/repositories" },
36 { :controller => 'repositories', :action => 'create', :project_id => 'redmine' }
37 )
38 assert_routing(
39 { :method => 'get',
40 :path => "/repositories/1/edit" },
41 { :controller => 'repositories', :action => 'edit', :id => '1' }
42 )
43 assert_routing(
44 { :method => 'put',
45 :path => "/repositories/1" },
46 { :controller => 'repositories', :action => 'update', :id => '1' }
47 )
48 assert_routing(
49 { :method => 'delete',
50 :path => "/repositories/1" },
51 { :controller => 'repositories', :action => 'destroy', :id => '1' }
52 )
53 ["get", "post"].each do |method|
54 assert_routing(
55 { :method => method,
56 :path => "/repositories/1/committers" },
57 { :controller => 'repositories', :action => 'committers', :id => '1' }
58 )
59 end
60 end
61
33
62 def test_repositories_show
34 should_route 'GET /repositories/1/committers' => 'repositories#committers', :id => '1'
63 assert_routing(
35 should_route 'POST /repositories/1/committers' => 'repositories#committers', :id => '1'
64 { :method => 'get',
65 :path => "/projects/redmine/repository" },
66 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
67 )
68 end
36 end
69
37
70 def test_repositories
38 def test_repositories
71 assert_routing(
39 should_route 'GET /projects/foo/repository' => 'repositories#show', :id => 'foo'
72 { :method => 'get',
40 should_route 'GET /projects/foo/repository/statistics' => 'repositories#stats', :id => 'foo'
73 :path => "/projects/redmine/repository/statistics" },
41 should_route 'GET /projects/foo/repository/graph' => 'repositories#graph', :id => 'foo'
74 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
75 )
76 assert_routing(
77 { :method => 'get',
78 :path => "/projects/redmine/repository/graph" },
79 { :controller => 'repositories', :action => 'graph', :id => 'redmine' }
80 )
81 end
82
83 def test_repositories_show_with_repository_id
84 assert_routing(
85 { :method => 'get',
86 :path => "/projects/redmine/repository/foo" },
87 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' }
88 )
89 end
42 end
90
43
91 def test_repositories_with_repository_id
44 def test_repositories_with_repository_id
92 assert_routing(
45 should_route 'GET /projects/foo/repository/svn' => 'repositories#show', :id => 'foo', :repository_id => 'svn'
93 { :method => 'get',
46 should_route 'GET /projects/foo/repository/svn/statistics' => 'repositories#stats', :id => 'foo', :repository_id => 'svn'
94 :path => "/projects/redmine/repository/foo/statistics" },
47 should_route 'GET /projects/foo/repository/svn/graph' => 'repositories#graph', :id => 'foo', :repository_id => 'svn'
95 { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' }
96 )
97 assert_routing(
98 { :method => 'get',
99 :path => "/projects/redmine/repository/foo/graph" },
100 { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' }
101 )
102 end
48 end
103
49
104 def test_repositories_revisions
50 def test_repositories_revisions
105 empty_path_param = []
51 should_route 'GET /projects/foo/repository/revision' => 'repositories#revision', :id => 'foo'
106 assert_routing(
52 should_route 'GET /projects/foo/repository/revisions' => 'repositories#revisions', :id => 'foo'
107 { :method => 'get',
53 should_route 'GET /projects/foo/repository/revisions.atom' => 'repositories#revisions', :id => 'foo', :format => 'atom'
108 :path => "/projects/redmine/repository/revisions" },
54
109 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
55 should_route 'GET /projects/foo/repository/revisions/2457' => 'repositories#revision', :id => 'foo', :rev => '2457'
110 )
56 should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457'
111 assert_routing(
57 should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457'
112 { :method => 'get',
58
113 :path => "/projects/redmine/repository/revisions.atom" },
59 should_route "GET /projects/foo/repository/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
114 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
60 :id => 'foo', :rev => '2457', :path => @path_hash[:param]
115 :format => 'atom' }
61 should_route "GET /projects/foo/repository/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
116 )
62 :id => 'foo', :rev => '2457', :path => @path_hash[:param]
117 assert_routing(
63 should_route "GET /projects/foo/repository/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
118 { :method => 'get',
64 :id => 'foo', :rev => '2457', :path => @path_hash[:param]
119 :path => "/projects/redmine/repository/revisions/2457" },
65 should_route "GET /projects/foo/repository/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
120 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
66 :id => 'foo', :rev => '2457', :path => @path_hash[:param]
121 :rev => '2457' }
67 should_route "GET /projects/foo/repository/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
122 )
68 :id => 'foo', :rev => '2457', :path => @path_hash[:param]
123 assert_routing(
124 { :method => 'get',
125 :path => "/projects/redmine/repository/revisions/2457/show" },
126 { :controller => 'repositories', :action => 'show', :id => 'redmine',
127 :rev => '2457' }
128 )
129 assert_routing(
130 { :method => 'get',
131 :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" },
132 { :controller => 'repositories', :action => 'show', :id => 'redmine',
133 :path => @path_hash[:param] , :rev => '2457'}
134 )
135 assert_routing(
136 { :method => 'get',
137 :path => "/projects/redmine/repository/revisions/2457/diff" },
138 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
139 :rev => '2457' }
140 )
141 assert_routing(
142 { :method => 'get',
143 :path => "/projects/redmine/repository/revisions/2457/diff" },
144 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
145 :rev => '2457', :format => 'diff' },
146 {},
147 { :format => 'diff' }
148 )
149 assert_routing(
150 { :method => 'get',
151 :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
152 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
153 :path => @path_hash[:param], :rev => '2' }
154 )
155 assert_routing(
156 { :method => 'get',
157 :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
158 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
159 :path => @path_hash[:param], :rev => '2', :format => 'diff' },
160 {},
161 { :format => 'diff' }
162 )
163 assert_routing(
164 { :method => 'get',
165 :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" },
166 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
167 :path => @path_hash[:param], :rev => '2' }
168 )
169 assert_routing(
170 { :method => 'get',
171 :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" },
172 { :controller => 'repositories', :action => 'raw', :id => 'redmine',
173 :path => @path_hash[:param], :rev => '2' }
174 )
175 assert_routing(
176 { :method => 'get',
177 :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" },
178 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
179 :path => @path_hash[:param], :rev => '2' }
180 )
181 end
69 end
182
70
183 def test_repositories_revisions_with_repository_id
71 def test_repositories_revisions_with_repository_id
184 empty_path_param = []
72 should_route 'GET /projects/foo/repository/foo/revision' => 'repositories#revision', :id => 'foo', :repository_id => 'foo'
185 assert_routing(
73 should_route 'GET /projects/foo/repository/foo/revisions' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo'
186 { :method => 'get',
74 should_route 'GET /projects/foo/repository/foo/revisions.atom' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo', :format => 'atom'
187 :path => "/projects/redmine/repository/foo/revisions" },
75
188 { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' }
76 should_route 'GET /projects/foo/repository/foo/revisions/2457' => 'repositories#revision', :id => 'foo', :repository_id => 'foo', :rev => '2457'
189 )
77 should_route 'GET /projects/foo/repository/foo/revisions/2457/show' => 'repositories#show', :id => 'foo', :repository_id => 'foo', :rev => '2457'
190 assert_routing(
78 should_route 'GET /projects/foo/repository/foo/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :repository_id => 'foo', :rev => '2457'
191 { :method => 'get',
79
192 :path => "/projects/redmine/repository/foo/revisions.atom" },
80 should_route "GET /projects/foo/repository/foo/revisions/2457/show/#{@path_hash[:path]}" => 'repositories#show',
193 { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo',
81 :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
194 :format => 'atom' }
82 should_route "GET /projects/foo/repository/foo/revisions/2457/diff/#{@path_hash[:path]}" => 'repositories#diff',
195 )
83 :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
196 assert_routing(
84 should_route "GET /projects/foo/repository/foo/revisions/2457/entry/#{@path_hash[:path]}" => 'repositories#entry',
197 { :method => 'get',
85 :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
198 :path => "/projects/redmine/repository/foo/revisions/2457" },
86 should_route "GET /projects/foo/repository/foo/revisions/2457/raw/#{@path_hash[:path]}" => 'repositories#raw',
199 { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo',
87 :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
200 :rev => '2457' }
88 should_route "GET /projects/foo/repository/foo/revisions/2457/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
201 )
89 :id => 'foo', :repository_id => 'foo', :rev => '2457', :path => @path_hash[:param]
202 assert_routing(
203 { :method => 'get',
204 :path => "/projects/redmine/repository/foo/revisions/2457/show" },
205 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
206 :rev => '2457' }
207 )
208 assert_routing(
209 { :method => 'get',
210 :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" },
211 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
212 :path => @path_hash[:param] , :rev => '2457'}
213 )
214 assert_routing(
215 { :method => 'get',
216 :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
217 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
218 :rev => '2457' }
219 )
220 assert_routing(
221 { :method => 'get',
222 :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
223 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
224 :rev => '2457', :format => 'diff' },
225 {},
226 { :format => 'diff' }
227 )
228 assert_routing(
229 { :method => 'get',
230 :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
231 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
232 :path => @path_hash[:param], :rev => '2' }
233 )
234 assert_routing(
235 { :method => 'get',
236 :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
237 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
238 :path => @path_hash[:param], :rev => '2', :format => 'diff' },
239 {},
240 { :format => 'diff' }
241 )
242 assert_routing(
243 { :method => 'get',
244 :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" },
245 { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
246 :path => @path_hash[:param], :rev => '2' }
247 )
248 assert_routing(
249 { :method => 'get',
250 :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" },
251 { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
252 :path => @path_hash[:param], :rev => '2' }
253 )
254 assert_routing(
255 { :method => 'get',
256 :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" },
257 { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
258 :path => @path_hash[:param], :rev => '2' }
259 )
260 end
90 end
261
91
262 def test_repositories_non_revisions_path
92 def test_repositories_non_revisions_path
263 assert_routing(
93 should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo'
264 { :method => 'get',
94
265 :path => "/projects/redmine/repository/changes" },
95 should_route "GET /projects/foo/repository/changes/#{@path_hash[:path]}" => 'repositories#changes',
266 { :controller => 'repositories', :action => 'changes', :id => 'redmine' }
96 :id => 'foo', :path => @path_hash[:param]
267 )
97 should_route "GET /projects/foo/repository/diff/#{@path_hash[:path]}" => 'repositories#diff',
268 ['2457', 'master', 'slash/slash'].each do |rev|
98 :id => 'foo', :path => @path_hash[:param]
269 assert_routing(
99 should_route "GET /projects/foo/repository/browse/#{@path_hash[:path]}" => 'repositories#browse',
270 { :method => 'get',
100 :id => 'foo', :path => @path_hash[:param]
271 :path => "/projects/redmine/repository/changes" },
101 should_route "GET /projects/foo/repository/entry/#{@path_hash[:path]}" => 'repositories#entry',
272 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
102 :id => 'foo', :path => @path_hash[:param]
273 :rev => rev },
103 should_route "GET /projects/foo/repository/raw/#{@path_hash[:path]}" => 'repositories#raw',
274 {},
104 :id => 'foo', :path => @path_hash[:param]
275 { :rev => rev }
105 should_route "GET /projects/foo/repository/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
276 )
106 :id => 'foo', :path => @path_hash[:param]
277 end
278 ['2457', 'master', 'slash/slash'].each do |rev|
279 assert_routing(
280 { :method => 'get',
281 :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
282 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
283 :path => @path_hash[:param], :rev => rev },
284 {},
285 { :rev => rev }
286 )
287 end
288 assert_routing(
289 { :method => 'get',
290 :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" },
291 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
292 :path => @path_hash[:param] }
293 )
294 assert_routing(
295 { :method => 'get',
296 :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" },
297 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
298 :path => @path_hash[:param] }
299 )
300 assert_routing(
301 { :method => 'get',
302 :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" },
303 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
304 :path => @path_hash[:param] }
305 )
306 assert_routing(
307 { :method => 'get',
308 :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" },
309 { :controller => 'repositories', :action => 'raw', :id => 'redmine',
310 :path => @path_hash[:param] }
311 )
312 assert_routing(
313 { :method => 'get',
314 :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" },
315 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
316 :path => @path_hash[:param] }
317 )
318 assert_routing(
319 { :method => 'get',
320 :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
321 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
322 :path => @path_hash[:param] }
323 )
324 assert_routing(
325 { :method => 'get',
326 :path => "/projects/redmine/repository/revision" },
327 { :controller => 'repositories', :action => 'revision', :id => 'redmine' }
328 )
329 end
107 end
330
108
331 def test_repositories_non_revisions_path_with_repository_id
109 def test_repositories_non_revisions_path_with_repository_id
332 assert_routing(
110 should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn'
333 { :method => 'get',
111
334 :path => "/projects/redmine/repository/foo/changes" },
112 should_route "GET /projects/foo/repository/svn/changes/#{@path_hash[:path]}" => 'repositories#changes',
335 { :controller => 'repositories', :action => 'changes',
113 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
336 :id => 'redmine', :repository_id => 'foo' }
114 should_route "GET /projects/foo/repository/svn/diff/#{@path_hash[:path]}" => 'repositories#diff',
337 )
115 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
338 ['2457', 'master', 'slash/slash'].each do |rev|
116 should_route "GET /projects/foo/repository/svn/browse/#{@path_hash[:path]}" => 'repositories#browse',
339 assert_routing(
117 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
340 { :method => 'get',
118 should_route "GET /projects/foo/repository/svn/entry/#{@path_hash[:path]}" => 'repositories#entry',
341 :path => "/projects/redmine/repository/foo/changes" },
119 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
342 { :controller => 'repositories', :action => 'changes',
120 should_route "GET /projects/foo/repository/svn/raw/#{@path_hash[:path]}" => 'repositories#raw',
343 :id => 'redmine',
121 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
344 :repository_id => 'foo', :rev => rev },
122 should_route "GET /projects/foo/repository/svn/annotate/#{@path_hash[:path]}" => 'repositories#annotate',
345 {},
123 :id => 'foo', :repository_id => 'svn', :path => @path_hash[:param]
346 { :rev => rev }
347 )
348 end
349 ['2457', 'master', 'slash/slash'].each do |rev|
350 assert_routing(
351 { :method => 'get',
352 :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
353 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
354 :repository_id => 'foo', :path => @path_hash[:param], :rev => rev },
355 {},
356 { :rev => rev }
357 )
358 end
359 assert_routing(
360 { :method => 'get',
361 :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" },
362 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
363 :path => @path_hash[:param] }
364 )
365 assert_routing(
366 { :method => 'get',
367 :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" },
368 { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo',
369 :path => @path_hash[:param] }
370 )
371 assert_routing(
372 { :method => 'get',
373 :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" },
374 { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
375 :path => @path_hash[:param] }
376 )
377 assert_routing(
378 { :method => 'get',
379 :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" },
380 { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
381 :path => @path_hash[:param] }
382 )
383 assert_routing(
384 { :method => 'get',
385 :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" },
386 { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
387 :path => @path_hash[:param] }
388 )
389 assert_routing(
390 { :method => 'get',
391 :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
392 { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo',
393 :path => @path_hash[:param] }
394 )
395 assert_routing(
396 { :method => 'get',
397 :path => "/projects/redmine/repository/foo/revision" },
398 { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'}
399 )
400 end
124 end
401
125
402 def test_repositories_related_issues
126 def test_repositories_related_issues
403 assert_routing(
127 should_route 'POST /projects/foo/repository/revisions/123/issues' => 'repositories#add_related_issue',
404 { :method => 'post',
128 :id => 'foo', :rev => '123'
405 :path => "/projects/redmine/repository/revisions/123/issues" },
129 should_route 'DELETE /projects/foo/repository/revisions/123/issues/25' => 'repositories#remove_related_issue',
406 { :controller => 'repositories', :action => 'add_related_issue',
130 :id => 'foo', :rev => '123', :issue_id => '25'
407 :id => 'redmine', :rev => '123' }
408 )
409 assert_routing(
410 { :method => 'delete',
411 :path => "/projects/redmine/repository/revisions/123/issues/25" },
412 { :controller => 'repositories', :action => 'remove_related_issue',
413 :id => 'redmine', :rev => '123', :issue_id => '25' }
414 )
415 end
131 end
416
132
417 def test_repositories_related_issues_with_repository_id
133 def test_repositories_related_issues_with_repository_id
418 assert_routing(
134 should_route 'POST /projects/foo/repository/svn/revisions/123/issues' => 'repositories#add_related_issue',
419 { :method => 'post',
135 :id => 'foo', :repository_id => 'svn', :rev => '123'
420 :path => "/projects/redmine/repository/foo/revisions/123/issues" },
136 should_route 'DELETE /projects/foo/repository/svn/revisions/123/issues/25' => 'repositories#remove_related_issue',
421 { :controller => 'repositories', :action => 'add_related_issue',
137 :id => 'foo', :repository_id => 'svn', :rev => '123', :issue_id => '25'
422 :id => 'redmine', :repository_id => 'foo', :rev => '123' }
423 )
424 assert_routing(
425 { :method => 'delete',
426 :path => "/projects/redmine/repository/foo/revisions/123/issues/25" },
427 { :controller => 'repositories', :action => 'remove_related_issue',
428 :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' }
429 )
430 end
138 end
431 end
139 end
@@ -17,37 +17,17
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingRolesTest < ActionDispatch::IntegrationTest
20 class RoutingRolesTest < Redmine::RoutingTest
21 def test_roles
21 def test_roles
22 assert_routing(
22 should_route 'GET /roles' => 'roles#index'
23 { :method => 'get', :path => "/roles" },
23 should_route 'GET /roles/new' => 'roles#new'
24 { :controller => 'roles', :action => 'index' }
24 should_route 'POST /roles' => 'roles#create'
25 )
25
26 assert_routing(
26 should_route 'GET /roles/2/edit' => 'roles#edit', :id => '2'
27 { :method => 'get', :path => "/roles/new" },
27 should_route 'PUT /roles/2' => 'roles#update', :id => '2'
28 { :controller => 'roles', :action => 'new' }
28 should_route 'DELETE /roles/2' => 'roles#destroy', :id => '2'
29 )
29
30 assert_routing(
30 should_route 'GET /roles/permissions' => 'roles#permissions'
31 { :method => 'post', :path => "/roles" },
31 should_route 'POST /roles/permissions' => 'roles#permissions'
32 { :controller => 'roles', :action => 'create' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/roles/2/edit" },
36 { :controller => 'roles', :action => 'edit', :id => '2' }
37 )
38 assert_routing(
39 { :method => 'put', :path => "/roles/2" },
40 { :controller => 'roles', :action => 'update', :id => '2' }
41 )
42 assert_routing(
43 { :method => 'delete', :path => "/roles/2" },
44 { :controller => 'roles', :action => 'destroy', :id => '2' }
45 )
46 ["get", "post"].each do |method|
47 assert_routing(
48 { :method => method, :path => "/roles/permissions" },
49 { :controller => 'roles', :action => 'permissions' }
50 )
51 end
52 end
32 end
53 end
33 end
@@ -17,15 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingSearchTest < ActionDispatch::IntegrationTest
20 class RoutingSearchTest < Redmine::RoutingTest
21 def test_search
21 def test_search
22 assert_routing(
22 should_route 'GET /search' => 'search#index'
23 { :method => 'get', :path => "/search" },
23 should_route 'GET /projects/foo/search' => 'search#index', :id => 'foo'
24 { :controller => 'search', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/foo/search" },
28 { :controller => 'search', :action => 'index', :id => 'foo' }
29 )
30 end
24 end
31 end
25 end
@@ -17,24 +17,13
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingSettingsTest < ActionDispatch::IntegrationTest
20 class RoutingSettingsTest < Redmine::RoutingTest
21 def test_settings
21 def test_settings
22 assert_routing(
22 should_route 'GET /settings' => 'settings#index'
23 { :method => 'get', :path => "/settings" },
23 should_route 'GET /settings/edit' => 'settings#edit'
24 { :controller => 'settings', :action => 'index' }
24 should_route 'POST /settings/edit' => 'settings#edit'
25 )
25
26 ["get", "post"].each do |method|
26 should_route 'GET /settings/plugin/testid' => 'settings#plugin', :id => 'testid'
27 assert_routing(
27 should_route 'POST /settings/plugin/testid' => 'settings#plugin', :id => 'testid'
28 { :method => method, :path => "/settings/edit" },
29 { :controller => 'settings', :action => 'edit' }
30 )
31 end
32 ["get", "post"].each do |method|
33 assert_routing(
34 { :method => method, :path => "/settings/plugin/testid" },
35 { :controller => 'settings', :action => 'plugin',
36 :id => 'testid' }
37 )
38 end
39 end
28 end
40 end
29 end
@@ -17,23 +17,11
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingSysTest < ActionDispatch::IntegrationTest
20 class RoutingSysTest < Redmine::RoutingTest
21 def test_sys
21 def test_sys
22 assert_routing(
22 should_route 'GET /sys/projects' => 'sys#projects'
23 { :method => 'get', :path => "/sys/projects" },
23 should_route 'POST /sys/projects/foo/repository' => 'sys#create_project_repository', :id => 'foo'
24 { :controller => 'sys', :action => 'projects' }
24 should_route 'GET /sys/fetch_changesets' => 'sys#fetch_changesets'
25 )
25 should_route 'POST /sys/fetch_changesets' => 'sys#fetch_changesets'
26 assert_routing(
27 { :method => 'post', :path => "/sys/projects/testid/repository" },
28 { :controller => 'sys', :action => 'create_project_repository', :id => 'testid' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/sys/fetch_changesets" },
32 { :controller => 'sys', :action => 'fetch_changesets' }
33 )
34 assert_routing(
35 { :method => 'post', :path => "/sys/fetch_changesets" },
36 { :controller => 'sys', :action => 'fetch_changesets' }
37 )
38 end
26 end
39 end
27 end
@@ -17,173 +17,59
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingTimelogsTest < ActionDispatch::IntegrationTest
20 class RoutingTimelogsTest < Redmine::RoutingTest
21 def test_timelogs_global
21 def test_timelogs_global
22 assert_routing(
22 should_route 'GET /time_entries' => 'timelog#index'
23 { :method => 'get', :path => "/time_entries" },
23 should_route 'GET /time_entries.csv' => 'timelog#index', :format => 'csv'
24 { :controller => 'timelog', :action => 'index' }
24 should_route 'GET /time_entries.atom' => 'timelog#index', :format => 'atom'
25 )
25 should_route 'GET /time_entries/new' => 'timelog#new'
26 assert_routing(
26 should_route 'POST /time_entries' => 'timelog#create'
27 { :method => 'get', :path => "/time_entries.csv" },
27
28 { :controller => 'timelog', :action => 'index', :format => 'csv' }
28 should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22'
29 )
29 should_route 'PUT /time_entries/22' => 'timelog#update', :id => '22'
30 assert_routing(
30 should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22'
31 { :method => 'get', :path => "/time_entries.atom" },
32 { :controller => 'timelog', :action => 'index', :format => 'atom' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/time_entries/new" },
36 { :controller => 'timelog', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/time_entries/22/edit" },
40 { :controller => 'timelog', :action => 'edit', :id => '22' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/time_entries" },
44 { :controller => 'timelog', :action => 'create' }
45 )
46 assert_routing(
47 { :method => 'put', :path => "/time_entries/22" },
48 { :controller => 'timelog', :action => 'update', :id => '22' }
49 )
50 assert_routing(
51 { :method => 'delete', :path => "/time_entries/55" },
52 { :controller => 'timelog', :action => 'destroy', :id => '55' }
53 )
54 end
31 end
55
32
56 def test_timelogs_scoped_under_project
33 def test_timelogs_scoped_under_project
57 assert_routing(
34 should_route 'GET /projects/foo/time_entries' => 'timelog#index', :project_id => 'foo'
58 { :method => 'get', :path => "/projects/567/time_entries" },
35 should_route 'GET /projects/foo/time_entries.csv' => 'timelog#index', :project_id => 'foo', :format => 'csv'
59 { :controller => 'timelog', :action => 'index', :project_id => '567' }
36 should_route 'GET /projects/foo/time_entries.atom' => 'timelog#index', :project_id => 'foo', :format => 'atom'
60 )
37 should_route 'GET /projects/foo/time_entries/new' => 'timelog#new', :project_id => 'foo'
61 assert_routing(
38 should_route 'POST /projects/foo/time_entries' => 'timelog#create', :project_id => 'foo'
62 { :method => 'get', :path => "/projects/567/time_entries.csv" },
39
63 { :controller => 'timelog', :action => 'index', :project_id => '567',
40 # TODO: unused?
64 :format => 'csv' }
41 should_route 'GET /projects/foo/time_entries/22/edit' => 'timelog#edit', :project_id => 'foo', :id => '22'
65 )
42 should_route 'PUT /projects/foo/time_entries/22' => 'timelog#update', :project_id => 'foo', :id => '22'
66 assert_routing(
43 should_route 'DELETE /projects/foo/time_entries/22' => 'timelog#destroy', :project_id => 'foo', :id => '22'
67 { :method => 'get', :path => "/projects/567/time_entries.atom" },
68 { :controller => 'timelog', :action => 'index', :project_id => '567',
69 :format => 'atom' }
70 )
71 assert_routing(
72 { :method => 'get', :path => "/projects/567/time_entries/new" },
73 { :controller => 'timelog', :action => 'new', :project_id => '567' }
74 )
75 assert_routing(
76 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
77 { :controller => 'timelog', :action => 'edit',
78 :id => '22', :project_id => '567' }
79 )
80 assert_routing(
81 { :method => 'post', :path => "/projects/567/time_entries" },
82 { :controller => 'timelog', :action => 'create',
83 :project_id => '567' }
84 )
85 assert_routing(
86 { :method => 'put', :path => "/projects/567/time_entries/22" },
87 { :controller => 'timelog', :action => 'update',
88 :id => '22', :project_id => '567' }
89 )
90 assert_routing(
91 { :method => 'delete', :path => "/projects/567/time_entries/55" },
92 { :controller => 'timelog', :action => 'destroy',
93 :id => '55', :project_id => '567' }
94 )
95 end
44 end
96
45
97 def test_timelogs_scoped_under_issues
46 def test_timelogs_scoped_under_issues
98 assert_routing(
47 should_route 'GET /issues/234/time_entries' => 'timelog#index', :issue_id => '234'
99 { :method => 'get', :path => "/issues/234/time_entries" },
48 should_route 'GET /issues/234/time_entries.csv' => 'timelog#index', :issue_id => '234', :format => 'csv'
100 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
49 should_route 'GET /issues/234/time_entries.atom' => 'timelog#index', :issue_id => '234', :format => 'atom'
101 )
50 should_route 'GET /issues/234/time_entries/new' => 'timelog#new', :issue_id => '234'
102 assert_routing(
51 should_route 'POST /issues/234/time_entries' => 'timelog#create', :issue_id => '234'
103 { :method => 'get', :path => "/issues/234/time_entries.csv" },
52
104 { :controller => 'timelog', :action => 'index', :issue_id => '234',
53 # TODO: unused?
105 :format => 'csv' }
54 should_route 'GET /issues/234/time_entries/22/edit' => 'timelog#edit', :issue_id => '234', :id => '22'
106 )
55 should_route 'PUT /issues/234/time_entries/22' => 'timelog#update', :issue_id => '234', :id => '22'
107 assert_routing(
56 should_route 'DELETE /issues/234/time_entries/22' => 'timelog#destroy', :issue_id => '234', :id => '22'
108 { :method => 'get', :path => "/issues/234/time_entries.atom" },
109 { :controller => 'timelog', :action => 'index', :issue_id => '234',
110 :format => 'atom' }
111 )
112 assert_routing(
113 { :method => 'get', :path => "/issues/234/time_entries/new" },
114 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
115 )
116 assert_routing(
117 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
118 { :controller => 'timelog', :action => 'edit', :id => '22',
119 :issue_id => '234' }
120 )
121 assert_routing(
122 { :method => 'post', :path => "/issues/234/time_entries" },
123 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
124 )
125 assert_routing(
126 { :method => 'put', :path => "/issues/234/time_entries/22" },
127 { :controller => 'timelog', :action => 'update', :id => '22',
128 :issue_id => '234' }
129 )
130 assert_routing(
131 { :method => 'delete', :path => "/issues/234/time_entries/55" },
132 { :controller => 'timelog', :action => 'destroy', :id => '55',
133 :issue_id => '234' }
134 )
135 end
57 end
136
58
137 def test_timelogs_report
59 def test_timelogs_report
138 assert_routing(
60 should_route 'GET /time_entries/report' => 'timelog#report'
139 { :method => 'get',
61 should_route 'GET /time_entries/report.csv' => 'timelog#report', :format => 'csv'
140 :path => "/time_entries/report" },
62
141 { :controller => 'timelog', :action => 'report' }
63 should_route 'GET /projects/foo/time_entries/report' => 'timelog#report', :project_id => 'foo'
142 )
64 should_route 'GET /projects/foo/time_entries/report.csv' => 'timelog#report', :project_id => 'foo', :format => 'csv'
143 assert_routing(
65
144 { :method => 'get',
66 should_route 'GET /issues/234/time_entries/report' => 'timelog#report', :issue_id => '234'
145 :path => "/time_entries/report.csv" },
67 should_route 'GET /issues/234/time_entries/report.csv' => 'timelog#report', :issue_id => '234', :format => 'csv'
146 { :controller => 'timelog', :action => 'report', :format => 'csv' }
147 )
148 assert_routing(
149 { :method => 'get',
150 :path => "/issues/234/time_entries/report" },
151 { :controller => 'timelog', :action => 'report', :issue_id => '234' }
152 )
153 assert_routing(
154 { :method => 'get',
155 :path => "/issues/234/time_entries/report.csv" },
156 { :controller => 'timelog', :action => 'report', :issue_id => '234',
157 :format => 'csv' }
158 )
159 assert_routing(
160 { :method => 'get',
161 :path => "/projects/567/time_entries/report" },
162 { :controller => 'timelog', :action => 'report', :project_id => '567' }
163 )
164 assert_routing(
165 { :method => 'get',
166 :path => "/projects/567/time_entries/report.csv" },
167 { :controller => 'timelog', :action => 'report', :project_id => '567',
168 :format => 'csv' }
169 )
170 end
68 end
171
69
172 def test_timelogs_bulk_edit
70 def test_timelogs_bulk_edit
173 assert_routing(
71 should_route 'GET /time_entries/bulk_edit' => 'timelog#bulk_edit'
174 { :method => 'delete',
72 should_route 'POST /time_entries/bulk_update' => 'timelog#bulk_update'
175 :path => "/time_entries/destroy" },
73 should_route 'DELETE /time_entries/destroy' => 'timelog#destroy'
176 { :controller => 'timelog', :action => 'destroy' }
177 )
178 assert_routing(
179 { :method => 'post',
180 :path => "/time_entries/bulk_update" },
181 { :controller => 'timelog', :action => 'bulk_update' }
182 )
183 assert_routing(
184 { :method => 'get',
185 :path => "/time_entries/bulk_edit" },
186 { :controller => 'timelog', :action => 'bulk_edit' }
187 )
188 end
74 end
189 end
75 end
@@ -17,41 +17,17
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingTrackersTest < ActionDispatch::IntegrationTest
20 class RoutingTrackersTest < Redmine::RoutingTest
21 def test_trackers
21 def test_trackers
22 assert_routing(
22 should_route 'GET /trackers' => 'trackers#index'
23 { :method => 'get', :path => "/trackers" },
23 should_route 'GET /trackers/new' => 'trackers#new'
24 { :controller => 'trackers', :action => 'index' }
24 should_route 'POST /trackers' => 'trackers#create'
25 )
25
26 assert_routing(
26 should_route 'GET /trackers/1/edit' => 'trackers#edit', :id => '1'
27 { :method => 'post', :path => "/trackers" },
27 should_route 'PUT /trackers/1' => 'trackers#update', :id => '1'
28 { :controller => 'trackers', :action => 'create' }
28 should_route 'DELETE /trackers/1' => 'trackers#destroy', :id => '1'
29 )
29
30 assert_routing(
30 should_route 'GET /trackers/fields' => 'trackers#fields'
31 { :method => 'get', :path => "/trackers/new" },
31 should_route 'POST /trackers/fields' => 'trackers#fields'
32 { :controller => 'trackers', :action => 'new' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/trackers/1/edit" },
36 { :controller => 'trackers', :action => 'edit', :id => '1' }
37 )
38 assert_routing(
39 { :method => 'put', :path => "/trackers/1" },
40 { :controller => 'trackers', :action => 'update',
41 :id => '1' }
42 )
43 assert_routing(
44 { :method => 'delete', :path => "/trackers/1" },
45 { :controller => 'trackers', :action => 'destroy',
46 :id => '1' }
47 )
48 assert_routing(
49 { :method => 'get', :path => "/trackers/fields" },
50 { :controller => 'trackers', :action => 'fields' }
51 )
52 assert_routing(
53 { :method => 'post', :path => "/trackers/fields" },
54 { :controller => 'trackers', :action => 'fields' }
55 )
56 end
32 end
57 end
33 end
@@ -17,39 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingUsersTest < ActionDispatch::IntegrationTest
20 class RoutingUsersTest < Redmine::RoutingTest
21 def test_users
21 def test_users
22 assert_routing(
22 should_route 'GET /users' => 'users#index'
23 { :method => 'get', :path => "/users" },
23 should_route 'GET /users/new' => 'users#new'
24 { :controller => 'users', :action => 'index' }
24 should_route 'POST /users' => 'users#create'
25 )
25
26 assert_routing(
26 should_route 'GET /users/44' => 'users#show', :id => '44'
27 { :method => 'get', :path => "/users/44" },
27 should_route 'GET /users/current' => 'users#show', :id => 'current'
28 { :controller => 'users', :action => 'show', :id => '44' }
28 should_route 'GET /users/44/edit' => 'users#edit', :id => '44'
29 )
29 should_route 'PUT /users/44' => 'users#update', :id => '44'
30 assert_routing(
30 should_route 'DELETE /users/44' => 'users#destroy', :id => '44'
31 { :method => 'get', :path => "/users/current" },
32 { :controller => 'users', :action => 'show', :id => 'current' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/users/new" },
36 { :controller => 'users', :action => 'new' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/users/444/edit" },
40 { :controller => 'users', :action => 'edit', :id => '444' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/users" },
44 { :controller => 'users', :action => 'create' }
45 )
46 assert_routing(
47 { :method => 'put', :path => "/users/444" },
48 { :controller => 'users', :action => 'update', :id => '444' }
49 )
50 assert_routing(
51 { :method => 'delete', :path => "/users/44" },
52 { :controller => 'users', :action => 'destroy', :id => '44' }
53 )
54 end
31 end
55 end
32 end
@@ -17,53 +17,20
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingVersionsTest < ActionDispatch::IntegrationTest
20 class RoutingVersionsTest < Redmine::RoutingTest
21 def test_roadmap
21 def test_project_versions
22 # /projects/foo/versions is /projects/foo/roadmap
22 should_route 'GET /projects/foo/roadmap' => 'versions#index', :project_id => 'foo'
23 assert_routing(
23 should_route 'GET /projects/foo/versions/new' => 'versions#new', :project_id => 'foo'
24 { :method => 'get', :path => "/projects/33/roadmap" },
24 should_route 'POST /projects/foo/versions' => 'versions#create', :project_id => 'foo'
25 { :controller => 'versions', :action => 'index', :project_id => '33' }
25 should_route 'PUT /projects/foo/versions/close_completed' => 'versions#close_completed', :project_id => 'foo'
26 )
27 end
28
29 def test_versions_scoped_under_project
30 assert_routing(
31 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
32 { :controller => 'versions', :action => 'close_completed',
33 :project_id => 'foo' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/foo/versions/new" },
37 { :controller => 'versions', :action => 'new',
38 :project_id => 'foo' }
39 )
40 assert_routing(
41 { :method => 'post', :path => "/projects/foo/versions" },
42 { :controller => 'versions', :action => 'create',
43 :project_id => 'foo' }
44 )
45 end
26 end
46
27
47 def test_versions
28 def test_versions
48 assert_routing(
29 should_route 'GET /versions/1' => 'versions#show', :id => '1'
49 { :method => 'get', :path => "/versions/1" },
30 should_route 'GET /versions/1/edit' => 'versions#edit', :id => '1'
50 { :controller => 'versions', :action => 'show', :id => '1' }
31 should_route 'PUT /versions/1' => 'versions#update', :id => '1'
51 )
32 should_route 'DELETE /versions/1' => 'versions#destroy', :id => '1'
52 assert_routing(
33
53 { :method => 'get', :path => "/versions/1/edit" },
34 should_route 'POST /versions/1/status_by' => 'versions#status_by', :id => '1'
54 { :controller => 'versions', :action => 'edit', :id => '1' }
55 )
56 assert_routing(
57 { :method => 'put', :path => "/versions/1" },
58 { :controller => 'versions', :action => 'update', :id => '1' }
59 )
60 assert_routing(
61 { :method => 'delete', :path => "/versions/1" },
62 { :controller => 'versions', :action => 'destroy', :id => '1' }
63 )
64 assert_routing(
65 { :method => 'post', :path => "/versions/1/status_by" },
66 { :controller => 'versions', :action => 'status_by', :id => '1' }
67 )
68 end
35 end
69 end
36 end
@@ -17,35 +17,15
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingWatchersTest < ActionDispatch::IntegrationTest
20 class RoutingWatchersTest < Redmine::RoutingTest
21 def test_watchers
21 def test_watchers
22 assert_routing(
22 should_route 'GET /watchers/new' => 'watchers#new'
23 { :method => 'get', :path => "/watchers/new" },
23 should_route 'POST /watchers/append' => 'watchers#append'
24 { :controller => 'watchers', :action => 'new' }
24 should_route 'POST /watchers' => 'watchers#create'
25 )
25 should_route 'DELETE /watchers' => 'watchers#destroy'
26 assert_routing(
26 should_route 'GET /watchers/autocomplete_for_user' => 'watchers#autocomplete_for_user'
27 { :method => 'post', :path => "/watchers/append" },
27
28 { :controller => 'watchers', :action => 'append' }
28 should_route 'POST /watchers/watch' => 'watchers#watch'
29 )
29 should_route 'DELETE /watchers/watch' => 'watchers#unwatch'
30 assert_routing(
31 { :method => 'post', :path => "/watchers" },
32 { :controller => 'watchers', :action => 'create' }
33 )
34 assert_routing(
35 { :method => 'delete', :path => "/watchers" },
36 { :controller => 'watchers', :action => 'destroy' }
37 )
38 assert_routing(
39 { :method => 'get', :path => "/watchers/autocomplete_for_user" },
40 { :controller => 'watchers', :action => 'autocomplete_for_user' }
41 )
42 assert_routing(
43 { :method => 'post', :path => "/watchers/watch" },
44 { :controller => 'watchers', :action => 'watch' }
45 )
46 assert_routing(
47 { :method => 'delete', :path => "/watchers/watch" },
48 { :controller => 'watchers', :action => 'unwatch' }
49 )
50 end
30 end
51 end
31 end
@@ -17,15 +17,9
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingWelcomeTest < ActionDispatch::IntegrationTest
20 class RoutingWelcomeTest < Redmine::RoutingTest
21 def test_welcome
21 def test_welcome
22 assert_routing(
22 should_route 'GET /' => 'welcome#index'
23 { :method => 'get', :path => "/" },
23 should_route 'GET /robots.txt' => 'welcome#robots'
24 { :controller => 'welcome', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/robots.txt" },
28 { :controller => 'welcome', :action => 'robots' }
29 )
30 end
24 end
31 end
25 end
@@ -17,119 +17,43
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingWikiTest < ActionDispatch::IntegrationTest
20 class RoutingWikiTest < Redmine::RoutingTest
21 def test_wiki_matching
21 def test_wiki
22 assert_routing(
22 should_route 'GET /projects/foo/wiki' => 'wiki#show', :project_id => 'foo'
23 { :method => 'get', :path => "/projects/567/wiki" },
23 should_route 'GET /projects/foo/wiki/index' => 'wiki#index', :project_id => 'foo'
24 { :controller => 'wiki', :action => 'show', :project_id => '567' }
24 should_route 'GET /projects/foo/wiki/date_index' => 'wiki#date_index', :project_id => 'foo'
25 )
25 should_route 'GET /projects/foo/wiki/export' => 'wiki#export', :project_id => 'foo'
26 assert_routing(
26 should_route 'GET /projects/foo/wiki/export.pdf' => 'wiki#export', :project_id => 'foo', :format => 'pdf'
27 { :method => 'get', :path => "/projects/567/wiki/lalala" },
27 end
28 { :controller => 'wiki', :action => 'show', :project_id => '567',
28
29 :id => 'lalala' }
29 def test_wiki_pages
30 )
30 should_route 'GET /projects/foo/wiki/page' => 'wiki#show', :project_id => 'foo', :id => 'page'
31 assert_routing(
31 should_route 'GET /projects/foo/wiki/page.pdf' => 'wiki#show', :project_id => 'foo', :id => 'page', :format => 'pdf'
32 { :method => 'get', :path => "/projects/567/wiki/lalala.pdf" },
32
33 { :controller => 'wiki', :action => 'show', :project_id => '567',
33 should_route 'GET /projects/foo/wiki/page/edit' => 'wiki#edit', :project_id => 'foo', :id => 'page'
34 :id => 'lalala', :format => 'pdf' }
34 should_route 'PUT /projects/foo/wiki/page' => 'wiki#update', :project_id => 'foo', :id => 'page'
35 )
35 should_route 'DELETE /projects/foo/wiki/page' => 'wiki#destroy', :project_id => 'foo', :id => 'page'
36 assert_routing(
36
37 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
37 should_route 'GET /projects/foo/wiki/page/history' => 'wiki#history', :project_id => 'foo', :id => 'page'
38 { :controller => 'wiki', :action => 'diff', :project_id => '1',
38 should_route 'GET /projects/foo/wiki/page/diff' => 'wiki#diff', :project_id => 'foo', :id => 'page'
39 :id => 'CookBook_documentation' }
39 should_route 'GET /projects/foo/wiki/page/rename' => 'wiki#rename', :project_id => 'foo', :id => 'page'
40 )
40 should_route 'POST /projects/foo/wiki/page/rename' => 'wiki#rename', :project_id => 'foo', :id => 'page'
41 assert_routing(
41 should_route 'POST /projects/foo/wiki/page/protect' => 'wiki#protect', :project_id => 'foo', :id => 'page'
42 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2" },
42 should_route 'POST /projects/foo/wiki/page/add_attachment' => 'wiki#add_attachment', :project_id => 'foo', :id => 'page'
43 { :controller => 'wiki', :action => 'show', :project_id => '1',
43
44 :id => 'CookBook_documentation', :version => '2' }
44 should_route 'POST /projects/foo/wiki/page/preview' => 'wiki#preview', :project_id => 'foo', :id => 'page'
45 )
45 should_route 'PUT /projects/foo/wiki/page/preview' => 'wiki#preview', :project_id => 'foo', :id => 'page'
46 assert_routing(
46
47 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
48 { :controller => 'wiki', :action => 'diff', :project_id => '1',
49 :id => 'CookBook_documentation', :version => '2' }
50 )
51 assert_routing(
52 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/annotate" },
53 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
54 :id => 'CookBook_documentation', :version => '2' }
55 )
56 # Make sure we don't route wiki page sub-uris to let plugins handle them
47 # Make sure we don't route wiki page sub-uris to let plugins handle them
57 assert_raise(Minitest::Assertion) do
48 assert_raise(Minitest::Assertion) do
58 assert_recognizes({}, {:method => 'get', :path => "/projects/1/wiki/CookBook_documentation/whatever"})
49 assert_recognizes({}, {:method => 'get', :path => "/projects/foo/wiki/page/whatever"})
59 end
50 end
60 end
51 end
61
52
62 def test_wiki_misc
53 def test_wiki_page_versions
63 assert_routing(
54 should_route 'GET /projects/foo/wiki/page/2' => 'wiki#show', :project_id => 'foo', :id => 'page', :version => '2'
64 { :method => 'get', :path => "/projects/567/wiki/date_index" },
55 should_route 'GET /projects/foo/wiki/page/2/diff' => 'wiki#diff', :project_id => 'foo', :id => 'page', :version => '2'
65 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
56 should_route 'GET /projects/foo/wiki/page/2/annotate' => 'wiki#annotate', :project_id => 'foo', :id => 'page', :version => '2'
66 )
57 should_route 'DELETE /projects/foo/wiki/page/2' => 'wiki#destroy_version', :project_id => 'foo', :id => 'page', :version => '2'
67 assert_routing(
68 { :method => 'get', :path => "/projects/567/wiki/export" },
69 { :controller => 'wiki', :action => 'export', :project_id => '567' }
70 )
71 assert_routing(
72 { :method => 'get', :path => "/projects/567/wiki/export.pdf" },
73 { :controller => 'wiki', :action => 'export', :project_id => '567', :format => 'pdf' }
74 )
75 assert_routing(
76 { :method => 'get', :path => "/projects/567/wiki/index" },
77 { :controller => 'wiki', :action => 'index', :project_id => '567' }
78 )
79 end
80
81 def test_wiki_resources
82 assert_routing(
83 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
84 { :controller => 'wiki', :action => 'edit', :project_id => '567',
85 :id => 'my_page' }
86 )
87 assert_routing(
88 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
89 { :controller => 'wiki', :action => 'history', :project_id => '1',
90 :id => 'CookBook_documentation' }
91 )
92 assert_routing(
93 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
94 { :controller => 'wiki', :action => 'rename', :project_id => '22',
95 :id => 'ladida' }
96 )
97 ["post", "put"].each do |method|
98 assert_routing(
99 { :method => method, :path => "/projects/567/wiki/CookBook_documentation/preview" },
100 { :controller => 'wiki', :action => 'preview', :project_id => '567',
101 :id => 'CookBook_documentation' }
102 )
103 end
104 assert_routing(
105 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
106 { :controller => 'wiki', :action => 'rename', :project_id => '22',
107 :id => 'ladida' }
108 )
109 assert_routing(
110 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
111 { :controller => 'wiki', :action => 'protect', :project_id => '22',
112 :id => 'ladida' }
113 )
114 assert_routing(
115 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
116 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
117 :id => 'ladida' }
118 )
119 assert_routing(
120 { :method => 'put', :path => "/projects/567/wiki/my_page" },
121 { :controller => 'wiki', :action => 'update', :project_id => '567',
122 :id => 'my_page' }
123 )
124 assert_routing(
125 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
126 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
127 :id => 'ladida' }
128 )
129 assert_routing(
130 { :method => 'delete', :path => "/projects/22/wiki/ladida/3" },
131 { :controller => 'wiki', :action => 'destroy_version', :project_id => '22',
132 :id => 'ladida', :version => '3' }
133 )
134 end
58 end
135 end
59 end
@@ -17,17 +17,11
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingWikisTest < ActionDispatch::IntegrationTest
20 class RoutingWikisTest < Redmine::RoutingTest
21 def test_wikis_plural_admin_setup
21 def test_wikis
22 ["get", "post"].each do |method|
22 should_route 'POST /projects/foo/wiki' => 'wikis#edit', :id => 'foo'
23 assert_routing(
23
24 { :method => method, :path => "/projects/ladida/wiki/destroy" },
24 should_route 'GET /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
25 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
25 should_route 'POST /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
26 )
27 end
28 assert_routing(
29 { :method => 'post', :path => "/projects/ladida/wiki" },
30 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
31 )
32 end
26 end
33 end
27 end
@@ -17,29 +17,16
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class RoutingWorkflowsTest < ActionDispatch::IntegrationTest
20 class RoutingWorkflowsTest < Redmine::RoutingTest
21 def test_workflows
21 def test_workflows
22 assert_routing(
22 should_route 'GET /workflows' => 'workflows#index'
23 { :method => 'get', :path => "/workflows" },
23 should_route 'GET /workflows/edit' => 'workflows#edit'
24 { :controller => 'workflows', :action => 'index' }
24 should_route 'POST /workflows/edit' => 'workflows#edit'
25 )
25
26 ["get", "post"].each do |method|
26 should_route 'GET /workflows/permissions' => 'workflows#permissions'
27 assert_routing(
27 should_route 'POST /workflows/permissions' => 'workflows#permissions'
28 { :method => method, :path => "/workflows/edit" },
28
29 { :controller => 'workflows', :action => 'edit' }
29 should_route 'GET /workflows/copy' => 'workflows#copy'
30 )
30 should_route 'POST /workflows/copy' => 'workflows#copy'
31 end
32 ["get", "post"].each do |method|
33 assert_routing(
34 { :method => method, :path => "/workflows/permissions" },
35 { :controller => 'workflows', :action => 'permissions' }
36 )
37 end
38 ["get", "post"].each do |method|
39 assert_routing(
40 { :method => method, :path => "/workflows/copy" },
41 { :controller => 'workflows', :action => 'copy' }
42 )
43 end
44 end
31 end
45 end
32 end
General Comments 0
You need to be logged in to leave comments. Login now