@@ -1,349 +1,346 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | RedmineApp::Application.routes.draw do |
|
18 | RedmineApp::Application.routes.draw do | |
19 | root :to => 'welcome#index', :as => 'home' |
|
19 | root :to => 'welcome#index', :as => 'home' | |
20 |
|
20 | |||
21 | match 'login', :to => 'account#login', :as => 'signin' |
|
21 | match 'login', :to => 'account#login', :as => 'signin' | |
22 | match 'logout', :to => 'account#logout', :as => 'signout' |
|
22 | match 'logout', :to => 'account#logout', :as => 'signout' | |
23 | match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' |
|
23 | match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' | |
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' |
|
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' | |
25 | match 'account/activate', :to => 'account#activate', :via => :get |
|
25 | match 'account/activate', :to => 'account#activate', :via => :get | |
26 |
|
26 | |||
27 | match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news' |
|
27 | match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news' | |
28 | match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue' |
|
28 | match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue' | |
29 | match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue' |
|
29 | match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue' | |
30 | match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue' |
|
30 | match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue' | |
31 |
|
31 | |||
32 | match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post |
|
32 | match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post | |
33 | match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] |
|
33 | match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] | |
34 |
|
34 | |||
35 | match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] |
|
35 | match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] | |
36 | get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' |
|
36 | get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' | |
37 | match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] |
|
37 | match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] | |
38 | get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
38 | get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' | |
39 |
|
39 | |||
40 | post 'boards/:board_id/topics/preview', :to => 'messages#preview' |
|
40 | post 'boards/:board_id/topics/preview', :to => 'messages#preview' | |
41 | post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' |
|
41 | post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' | |
42 | post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' |
|
42 | post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' | |
43 | post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' |
|
43 | post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' | |
44 |
|
44 | |||
45 | # Misc issue routes. TODO: move into resources |
|
45 | # Misc issue routes. TODO: move into resources | |
46 | match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' |
|
46 | match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' | |
47 | match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu' |
|
47 | match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu' | |
48 | match '/issues/changes', :to => 'journals#index', :as => 'issue_changes' |
|
48 | match '/issues/changes', :to => 'journals#index', :as => 'issue_changes' | |
49 | match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' |
|
49 | match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' | |
50 |
|
50 | |||
51 | match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get |
|
51 | match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get | |
52 | match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] |
|
52 | match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] | |
53 |
|
53 | |||
54 | match '/projects/:project_id/issues/gantt', :to => 'gantts#show' |
|
54 | match '/projects/:project_id/issues/gantt', :to => 'gantts#show' | |
55 | match '/issues/gantt', :to => 'gantts#show' |
|
55 | match '/issues/gantt', :to => 'gantts#show' | |
56 |
|
56 | |||
57 | match '/projects/:project_id/issues/calendar', :to => 'calendars#show' |
|
57 | match '/projects/:project_id/issues/calendar', :to => 'calendars#show' | |
58 | match '/issues/calendar', :to => 'calendars#show' |
|
58 | match '/issues/calendar', :to => 'calendars#show' | |
59 |
|
59 | |||
60 | match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get |
|
60 | match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get | |
61 | match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get |
|
61 | match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get | |
62 |
|
62 | |||
63 | match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] |
|
63 | match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] | |
64 | match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] |
|
64 | match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] | |
65 | match 'my/page', :controller => 'my', :action => 'page', :via => :get |
|
65 | match 'my/page', :controller => 'my', :action => 'page', :via => :get | |
66 | match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page |
|
66 | match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page | |
67 | match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post |
|
67 | match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post | |
68 | match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post |
|
68 | match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post | |
69 | match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] |
|
69 | match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] | |
70 | match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get |
|
70 | match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get | |
71 | match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post |
|
71 | match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post | |
72 | match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post |
|
72 | match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post | |
73 | match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post |
|
73 | match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post | |
74 |
|
74 | |||
75 | resources :users |
|
75 | resources :users | |
76 | match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' |
|
76 | match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' | |
77 | match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete |
|
77 | match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete | |
78 | match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' |
|
78 | match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' | |
79 |
|
79 | |||
80 | match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get |
|
80 | match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get | |
81 | match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post |
|
81 | match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post | |
82 | match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post |
|
82 | match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post | |
83 | match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post |
|
83 | match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post | |
84 | match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post |
|
84 | match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post | |
85 | match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post |
|
85 | match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post | |
86 | match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get |
|
86 | match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get | |
87 |
|
87 | |||
88 | match 'projects/:id/settings/:tab', :to => "projects#settings" |
|
88 | match 'projects/:id/settings/:tab', :to => "projects#settings" | |
89 |
|
89 | |||
90 | resources :projects do |
|
90 | resources :projects do | |
91 | member do |
|
91 | member do | |
92 | get 'settings' |
|
92 | get 'settings' | |
93 | post 'modules' |
|
93 | post 'modules' | |
94 | post 'archive' |
|
94 | post 'archive' | |
95 | post 'unarchive' |
|
95 | post 'unarchive' | |
96 | post 'close' |
|
96 | post 'close' | |
97 | post 'reopen' |
|
97 | post 'reopen' | |
98 | match 'copy', :via => [:get, :post] |
|
98 | match 'copy', :via => [:get, :post] | |
99 | end |
|
99 | end | |
100 |
|
100 | |||
101 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do |
|
101 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do | |
102 | collection do |
|
102 | collection do | |
103 | get 'autocomplete' |
|
103 | get 'autocomplete' | |
104 | end |
|
104 | end | |
105 | end |
|
105 | end | |
106 |
|
106 | |||
107 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] |
|
107 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] | |
108 |
|
108 | |||
109 | match 'issues/:copy_from/copy', :to => 'issues#new' |
|
109 | match 'issues/:copy_from/copy', :to => 'issues#new' | |
110 | resources :issues, :only => [:index, :new, :create] do |
|
110 | resources :issues, :only => [:index, :new, :create] do | |
111 | resources :time_entries, :controller => 'timelog' do |
|
111 | resources :time_entries, :controller => 'timelog' do | |
112 | collection do |
|
112 | collection do | |
113 | get 'report' |
|
113 | get 'report' | |
114 | end |
|
114 | end | |
115 | end |
|
115 | end | |
116 | end |
|
116 | end | |
117 | # issue form update |
|
117 | # issue form update | |
118 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' |
|
118 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' | |
119 |
|
119 | |||
120 | resources :files, :only => [:index, :new, :create] |
|
120 | resources :files, :only => [:index, :new, :create] | |
121 |
|
121 | |||
122 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do |
|
122 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do | |
123 | collection do |
|
123 | collection do | |
124 | put 'close_completed' |
|
124 | put 'close_completed' | |
125 | end |
|
125 | end | |
126 | end |
|
126 | end | |
127 | match 'versions.:format', :to => 'versions#index' |
|
127 | match 'versions.:format', :to => 'versions#index' | |
128 | match 'roadmap', :to => 'versions#index', :format => false |
|
128 | match 'roadmap', :to => 'versions#index', :format => false | |
129 | match 'versions', :to => 'versions#index' |
|
129 | match 'versions', :to => 'versions#index' | |
130 |
|
130 | |||
131 | resources :news, :except => [:show, :edit, :update, :destroy] |
|
131 | resources :news, :except => [:show, :edit, :update, :destroy] | |
132 | resources :time_entries, :controller => 'timelog' do |
|
132 | resources :time_entries, :controller => 'timelog' do | |
133 | get 'report', :on => :collection |
|
133 | get 'report', :on => :collection | |
134 | end |
|
134 | end | |
135 | resources :queries, :only => [:new, :create] |
|
135 | resources :queries, :only => [:new, :create] | |
136 | resources :issue_categories, :shallow => true |
|
136 | resources :issue_categories, :shallow => true | |
137 | resources :documents, :except => [:show, :edit, :update, :destroy] |
|
137 | resources :documents, :except => [:show, :edit, :update, :destroy] | |
138 | resources :boards |
|
138 | resources :boards | |
139 | resources :repositories, :shallow => true, :except => [:index, :show] do |
|
139 | resources :repositories, :shallow => true, :except => [:index, :show] do | |
140 | member do |
|
140 | member do | |
141 | match 'committers', :via => [:get, :post] |
|
141 | match 'committers', :via => [:get, :post] | |
142 | end |
|
142 | end | |
143 | end |
|
143 | end | |
144 |
|
144 | |||
145 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get |
|
145 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get | |
146 | resources :wiki, :except => [:index, :new, :create] do |
|
146 | resources :wiki, :except => [:index, :new, :create] do | |
147 | member do |
|
147 | member do | |
148 | get 'rename' |
|
148 | get 'rename' | |
149 | post 'rename' |
|
149 | post 'rename' | |
150 | get 'history' |
|
150 | get 'history' | |
151 | get 'diff' |
|
151 | get 'diff' | |
152 | match 'preview', :via => [:post, :put] |
|
152 | match 'preview', :via => [:post, :put] | |
153 | post 'protect' |
|
153 | post 'protect' | |
154 | post 'add_attachment' |
|
154 | post 'add_attachment' | |
155 | end |
|
155 | end | |
156 | collection do |
|
156 | collection do | |
157 | get 'export' |
|
157 | get 'export' | |
158 | get 'date_index' |
|
158 | get 'date_index' | |
159 | end |
|
159 | end | |
160 | end |
|
160 | end | |
161 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get |
|
161 | match 'wiki', :controller => 'wiki', :action => 'show', :via => :get | |
162 | get 'wiki/:id/:version', :to => 'wiki#show' |
|
162 | get 'wiki/:id/:version', :to => 'wiki#show' | |
163 | delete 'wiki/:id/:version', :to => 'wiki#destroy_version' |
|
163 | delete 'wiki/:id/:version', :to => 'wiki#destroy_version' | |
164 | get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' |
|
164 | get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' | |
165 | get 'wiki/:id/:version/diff', :to => 'wiki#diff' |
|
165 | get 'wiki/:id/:version/diff', :to => 'wiki#diff' | |
166 | end |
|
166 | end | |
167 |
|
167 | |||
168 | resources :issues do |
|
168 | resources :issues do | |
169 | collection do |
|
169 | collection do | |
170 | match 'bulk_edit', :via => [:get, :post] |
|
170 | match 'bulk_edit', :via => [:get, :post] | |
171 | post 'bulk_update' |
|
171 | post 'bulk_update' | |
172 | end |
|
172 | end | |
173 | resources :time_entries, :controller => 'timelog' do |
|
173 | resources :time_entries, :controller => 'timelog' do | |
174 | collection do |
|
174 | collection do | |
175 | get 'report' |
|
175 | get 'report' | |
176 | end |
|
176 | end | |
177 | end |
|
177 | end | |
178 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
178 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
179 | end |
|
179 | end | |
180 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete |
|
180 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete | |
181 |
|
181 | |||
182 | resources :queries, :except => [:show] |
|
182 | resources :queries, :except => [:show] | |
183 |
|
183 | |||
184 | resources :news, :only => [:index, :show, :edit, :update, :destroy] |
|
184 | resources :news, :only => [:index, :show, :edit, :update, :destroy] | |
185 | match '/news/:id/comments', :to => 'comments#create', :via => :post |
|
185 | match '/news/:id/comments', :to => 'comments#create', :via => :post | |
186 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete |
|
186 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete | |
187 |
|
187 | |||
188 | resources :versions, :only => [:show, :edit, :update, :destroy] do |
|
188 | resources :versions, :only => [:show, :edit, :update, :destroy] do | |
189 | post 'status_by', :on => :member |
|
189 | post 'status_by', :on => :member | |
190 | end |
|
190 | end | |
191 |
|
191 | |||
192 | resources :documents, :only => [:show, :edit, :update, :destroy] do |
|
192 | resources :documents, :only => [:show, :edit, :update, :destroy] do | |
193 | post 'add_attachment', :on => :member |
|
193 | post 'add_attachment', :on => :member | |
194 | end |
|
194 | end | |
195 |
|
195 | |||
196 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu |
|
196 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu | |
197 |
|
197 | |||
198 | resources :time_entries, :controller => 'timelog', :except => :destroy do |
|
198 | resources :time_entries, :controller => 'timelog', :except => :destroy do | |
199 | collection do |
|
199 | collection do | |
200 | get 'report' |
|
200 | get 'report' | |
201 | get 'bulk_edit' |
|
201 | get 'bulk_edit' | |
202 | post 'bulk_update' |
|
202 | post 'bulk_update' | |
203 | end |
|
203 | end | |
204 | end |
|
204 | end | |
205 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ |
|
205 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ | |
206 | # TODO: delete /time_entries for bulk deletion |
|
206 | # TODO: delete /time_entries for bulk deletion | |
207 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete |
|
207 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete | |
208 |
|
208 | |||
209 | # TODO: port to be part of the resources route(s) |
|
209 | # TODO: port to be part of the resources route(s) | |
210 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get |
|
210 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get | |
211 |
|
211 | |||
212 | get 'projects/:id/activity', :to => 'activities#index' |
|
212 | get 'projects/:id/activity', :to => 'activities#index' | |
213 | get 'projects/:id/activity.:format', :to => 'activities#index' |
|
213 | get 'projects/:id/activity.:format', :to => 'activities#index' | |
214 | get 'activity', :to => 'activities#index' |
|
214 | get 'activity', :to => 'activities#index' | |
215 |
|
215 | |||
216 | # repositories routes |
|
216 | # repositories routes | |
217 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' |
|
217 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' | |
218 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' |
|
218 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' | |
219 |
|
219 | |||
220 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', |
|
220 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', | |
221 | :to => 'repositories#changes' |
|
221 | :to => 'repositories#changes' | |
222 |
|
222 | |||
223 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' |
|
223 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' | |
224 |
|
|
224 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' | |
225 | :to => 'repositories#revision', |
|
|||
226 | :via => [:get, :post] |
|
|||
227 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
225 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
228 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
226 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
229 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' |
|
227 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' | |
230 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', |
|
228 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', | |
231 | :controller => 'repositories', |
|
229 | :controller => 'repositories', | |
232 | :format => false, |
|
230 | :format => false, | |
233 | :constraints => { |
|
231 | :constraints => { | |
234 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
232 | :action => /(browse|show|entry|raw|annotate|diff)/, | |
235 | :rev => /[a-z0-9\.\-_]+/ |
|
233 | :rev => /[a-z0-9\.\-_]+/ | |
236 | } |
|
234 | } | |
237 |
|
235 | |||
238 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' |
|
236 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' | |
239 | get 'projects/:id/repository/graph', :to => 'repositories#graph' |
|
237 | get 'projects/:id/repository/graph', :to => 'repositories#graph' | |
240 |
|
238 | |||
241 | get 'projects/:id/repository/changes(/*path(.:ext))', |
|
239 | get 'projects/:id/repository/changes(/*path(.:ext))', | |
242 | :to => 'repositories#changes' |
|
240 | :to => 'repositories#changes' | |
243 |
|
241 | |||
244 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' |
|
242 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' | |
245 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' |
|
243 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' | |
246 |
|
|
244 | get 'projects/:id/repository/revision', :to => 'repositories#revision' | |
247 | :via => [:get, :post] |
|
|||
248 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
245 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
249 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
246 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
250 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', |
|
247 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', | |
251 | :controller => 'repositories', |
|
248 | :controller => 'repositories', | |
252 | :format => false, |
|
249 | :format => false, | |
253 | :constraints => { |
|
250 | :constraints => { | |
254 | :action => /(browse|show|entry|raw|annotate|diff)/, |
|
251 | :action => /(browse|show|entry|raw|annotate|diff)/, | |
255 | :rev => /[a-z0-9\.\-_]+/ |
|
252 | :rev => /[a-z0-9\.\-_]+/ | |
256 | } |
|
253 | } | |
257 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', |
|
254 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', | |
258 | :controller => 'repositories', |
|
255 | :controller => 'repositories', | |
259 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
256 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
260 | get 'projects/:id/repository/:action(/*path(.:ext))', |
|
257 | get 'projects/:id/repository/:action(/*path(.:ext))', | |
261 | :controller => 'repositories', |
|
258 | :controller => 'repositories', | |
262 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ |
|
259 | :action => /(browse|show|entry|raw|changes|annotate|diff)/ | |
263 |
|
260 | |||
264 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil |
|
261 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil | |
265 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil |
|
262 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil | |
266 |
|
263 | |||
267 | # additional routes for having the file name at the end of url |
|
264 | # additional routes for having the file name at the end of url | |
268 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get |
|
265 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get | |
269 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get |
|
266 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get | |
270 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get |
|
267 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get | |
271 | match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ |
|
268 | match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ | |
272 | resources :attachments, :only => [:show, :destroy] |
|
269 | resources :attachments, :only => [:show, :destroy] | |
273 |
|
270 | |||
274 | resources :groups do |
|
271 | resources :groups do | |
275 | member do |
|
272 | member do | |
276 | get 'autocomplete_for_user' |
|
273 | get 'autocomplete_for_user' | |
277 | end |
|
274 | end | |
278 | end |
|
275 | end | |
279 |
|
276 | |||
280 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' |
|
277 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' | |
281 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' |
|
278 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' | |
282 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post |
|
279 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post | |
283 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post |
|
280 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post | |
284 |
|
281 | |||
285 | resources :trackers, :except => :show do |
|
282 | resources :trackers, :except => :show do | |
286 | collection do |
|
283 | collection do | |
287 | match 'fields', :via => [:get, :post] |
|
284 | match 'fields', :via => [:get, :post] | |
288 | end |
|
285 | end | |
289 | end |
|
286 | end | |
290 | resources :issue_statuses, :except => :show do |
|
287 | resources :issue_statuses, :except => :show do | |
291 | collection do |
|
288 | collection do | |
292 | post 'update_issue_done_ratio' |
|
289 | post 'update_issue_done_ratio' | |
293 | end |
|
290 | end | |
294 | end |
|
291 | end | |
295 | resources :custom_fields, :except => :show |
|
292 | resources :custom_fields, :except => :show | |
296 | resources :roles do |
|
293 | resources :roles do | |
297 | collection do |
|
294 | collection do | |
298 | match 'permissions', :via => [:get, :post] |
|
295 | match 'permissions', :via => [:get, :post] | |
299 | end |
|
296 | end | |
300 | end |
|
297 | end | |
301 | resources :enumerations, :except => :show |
|
298 | resources :enumerations, :except => :show | |
302 | match 'enumerations/:type', :to => 'enumerations#index', :via => :get |
|
299 | match 'enumerations/:type', :to => 'enumerations#index', :via => :get | |
303 |
|
300 | |||
304 | get 'projects/:id/search', :controller => 'search', :action => 'index' |
|
301 | get 'projects/:id/search', :controller => 'search', :action => 'index' | |
305 | get 'search', :controller => 'search', :action => 'index' |
|
302 | get 'search', :controller => 'search', :action => 'index' | |
306 |
|
303 | |||
307 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post |
|
304 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post | |
308 |
|
305 | |||
309 | match 'admin', :controller => 'admin', :action => 'index', :via => :get |
|
306 | match 'admin', :controller => 'admin', :action => 'index', :via => :get | |
310 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get |
|
307 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get | |
311 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get |
|
308 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get | |
312 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get |
|
309 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get | |
313 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get |
|
310 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get | |
314 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post |
|
311 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post | |
315 |
|
312 | |||
316 | resources :auth_sources do |
|
313 | resources :auth_sources do | |
317 | member do |
|
314 | member do | |
318 | get 'test_connection' |
|
315 | get 'test_connection' | |
319 | end |
|
316 | end | |
320 | end |
|
317 | end | |
321 |
|
318 | |||
322 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get |
|
319 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get | |
323 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] |
|
320 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] | |
324 | match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] |
|
321 | match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] | |
325 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] |
|
322 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] | |
326 | match 'settings', :controller => 'settings', :action => 'index', :via => :get |
|
323 | match 'settings', :controller => 'settings', :action => 'index', :via => :get | |
327 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] |
|
324 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] | |
328 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] |
|
325 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] | |
329 |
|
326 | |||
330 | match 'sys/projects', :to => 'sys#projects', :via => :get |
|
327 | match 'sys/projects', :to => 'sys#projects', :via => :get | |
331 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post |
|
328 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post | |
332 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get |
|
329 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get | |
333 |
|
330 | |||
334 | match 'uploads', :to => 'attachments#upload', :via => :post |
|
331 | match 'uploads', :to => 'attachments#upload', :via => :post | |
335 |
|
332 | |||
336 | get 'robots.txt', :to => 'welcome#robots' |
|
333 | get 'robots.txt', :to => 'welcome#robots' | |
337 |
|
334 | |||
338 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| |
|
335 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| | |
339 | file = File.join(plugin_dir, "config/routes.rb") |
|
336 | file = File.join(plugin_dir, "config/routes.rb") | |
340 | if File.exists?(file) |
|
337 | if File.exists?(file) | |
341 | begin |
|
338 | begin | |
342 | instance_eval File.read(file) |
|
339 | instance_eval File.read(file) | |
343 | rescue Exception => e |
|
340 | rescue Exception => e | |
344 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." |
|
341 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." | |
345 | exit 1 |
|
342 | exit 1 | |
346 | end |
|
343 | end | |
347 | end |
|
344 | end | |
348 | end |
|
345 | end | |
349 | end |
|
346 | end |
@@ -1,435 +1,431 | |||||
1 | # Redmine - project management software |
|
1 | # Redmine - project management software | |
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2012 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | require File.expand_path('../../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest |
|
20 | class RoutingRepositoriesTest < ActionController::IntegrationTest | |
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] | |
24 | assert_equal "path/to/file.c", @path_hash[:param] |
|
24 | assert_equal "path/to/file.c", @path_hash[:param] | |
25 | end |
|
25 | end | |
26 |
|
26 | |||
27 | def test_repositories_resources |
|
27 | def test_repositories_resources | |
28 | assert_routing( |
|
28 | assert_routing( | |
29 | { :method => 'get', |
|
29 | { :method => 'get', | |
30 | :path => "/projects/redmine/repositories/new" }, |
|
30 | :path => "/projects/redmine/repositories/new" }, | |
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } |
|
31 | { :controller => 'repositories', :action => 'new', :project_id => 'redmine' } | |
32 | ) |
|
32 | ) | |
33 | assert_routing( |
|
33 | assert_routing( | |
34 | { :method => 'post', |
|
34 | { :method => 'post', | |
35 | :path => "/projects/redmine/repositories" }, |
|
35 | :path => "/projects/redmine/repositories" }, | |
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } |
|
36 | { :controller => 'repositories', :action => 'create', :project_id => 'redmine' } | |
37 | ) |
|
37 | ) | |
38 | assert_routing( |
|
38 | assert_routing( | |
39 | { :method => 'get', |
|
39 | { :method => 'get', | |
40 | :path => "/repositories/1/edit" }, |
|
40 | :path => "/repositories/1/edit" }, | |
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } |
|
41 | { :controller => 'repositories', :action => 'edit', :id => '1' } | |
42 | ) |
|
42 | ) | |
43 | assert_routing( |
|
43 | assert_routing( | |
44 | { :method => 'put', |
|
44 | { :method => 'put', | |
45 | :path => "/repositories/1" }, |
|
45 | :path => "/repositories/1" }, | |
46 | { :controller => 'repositories', :action => 'update', :id => '1' } |
|
46 | { :controller => 'repositories', :action => 'update', :id => '1' } | |
47 | ) |
|
47 | ) | |
48 | assert_routing( |
|
48 | assert_routing( | |
49 | { :method => 'delete', |
|
49 | { :method => 'delete', | |
50 | :path => "/repositories/1" }, |
|
50 | :path => "/repositories/1" }, | |
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } |
|
51 | { :controller => 'repositories', :action => 'destroy', :id => '1' } | |
52 | ) |
|
52 | ) | |
53 | ["get", "post"].each do |method| |
|
53 | ["get", "post"].each do |method| | |
54 | assert_routing( |
|
54 | assert_routing( | |
55 | { :method => method, |
|
55 | { :method => method, | |
56 | :path => "/repositories/1/committers" }, |
|
56 | :path => "/repositories/1/committers" }, | |
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } |
|
57 | { :controller => 'repositories', :action => 'committers', :id => '1' } | |
58 | ) |
|
58 | ) | |
59 | end |
|
59 | end | |
60 | end |
|
60 | end | |
61 |
|
61 | |||
62 | def test_repositories_show |
|
62 | def test_repositories_show | |
63 | assert_routing( |
|
63 | assert_routing( | |
64 | { :method => 'get', |
|
64 | { :method => 'get', | |
65 | :path => "/projects/redmine/repository" }, |
|
65 | :path => "/projects/redmine/repository" }, | |
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } |
|
66 | { :controller => 'repositories', :action => 'show', :id => 'redmine' } | |
67 | ) |
|
67 | ) | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def test_repositories |
|
70 | def test_repositories | |
71 | assert_routing( |
|
71 | assert_routing( | |
72 | { :method => 'get', |
|
72 | { :method => 'get', | |
73 | :path => "/projects/redmine/repository/statistics" }, |
|
73 | :path => "/projects/redmine/repository/statistics" }, | |
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } |
|
74 | { :controller => 'repositories', :action => 'stats', :id => 'redmine' } | |
75 | ) |
|
75 | ) | |
76 | assert_routing( |
|
76 | assert_routing( | |
77 | { :method => 'get', |
|
77 | { :method => 'get', | |
78 | :path => "/projects/redmine/repository/graph" }, |
|
78 | :path => "/projects/redmine/repository/graph" }, | |
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } |
|
79 | { :controller => 'repositories', :action => 'graph', :id => 'redmine' } | |
80 | ) |
|
80 | ) | |
81 | end |
|
81 | end | |
82 |
|
82 | |||
83 | def test_repositories_show_with_repository_id |
|
83 | def test_repositories_show_with_repository_id | |
84 | assert_routing( |
|
84 | assert_routing( | |
85 | { :method => 'get', |
|
85 | { :method => 'get', | |
86 | :path => "/projects/redmine/repository/foo" }, |
|
86 | :path => "/projects/redmine/repository/foo" }, | |
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } |
|
87 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' } | |
88 | ) |
|
88 | ) | |
89 | end |
|
89 | end | |
90 |
|
90 | |||
91 | def test_repositories_with_repository_id |
|
91 | def test_repositories_with_repository_id | |
92 | assert_routing( |
|
92 | assert_routing( | |
93 | { :method => 'get', |
|
93 | { :method => 'get', | |
94 | :path => "/projects/redmine/repository/foo/statistics" }, |
|
94 | :path => "/projects/redmine/repository/foo/statistics" }, | |
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } |
|
95 | { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' } | |
96 | ) |
|
96 | ) | |
97 | assert_routing( |
|
97 | assert_routing( | |
98 | { :method => 'get', |
|
98 | { :method => 'get', | |
99 | :path => "/projects/redmine/repository/foo/graph" }, |
|
99 | :path => "/projects/redmine/repository/foo/graph" }, | |
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } |
|
100 | { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' } | |
101 | ) |
|
101 | ) | |
102 | end |
|
102 | end | |
103 |
|
103 | |||
104 | def test_repositories_revisions |
|
104 | def test_repositories_revisions | |
105 | empty_path_param = [] |
|
105 | empty_path_param = [] | |
106 | assert_routing( |
|
106 | assert_routing( | |
107 | { :method => 'get', |
|
107 | { :method => 'get', | |
108 | :path => "/projects/redmine/repository/revisions" }, |
|
108 | :path => "/projects/redmine/repository/revisions" }, | |
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } |
|
109 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine' } | |
110 | ) |
|
110 | ) | |
111 | assert_routing( |
|
111 | assert_routing( | |
112 | { :method => 'get', |
|
112 | { :method => 'get', | |
113 | :path => "/projects/redmine/repository/revisions.atom" }, |
|
113 | :path => "/projects/redmine/repository/revisions.atom" }, | |
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', |
|
114 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', | |
115 | :format => 'atom' } |
|
115 | :format => 'atom' } | |
116 | ) |
|
116 | ) | |
117 | assert_routing( |
|
117 | assert_routing( | |
118 | { :method => 'get', |
|
118 | { :method => 'get', | |
119 | :path => "/projects/redmine/repository/revisions/2457" }, |
|
119 | :path => "/projects/redmine/repository/revisions/2457" }, | |
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', |
|
120 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', | |
121 | :rev => '2457' } |
|
121 | :rev => '2457' } | |
122 | ) |
|
122 | ) | |
123 | assert_routing( |
|
123 | assert_routing( | |
124 | { :method => 'get', |
|
124 | { :method => 'get', | |
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, |
|
125 | :path => "/projects/redmine/repository/revisions/2457/show" }, | |
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
126 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
127 | :rev => '2457' } |
|
127 | :rev => '2457' } | |
128 | ) |
|
128 | ) | |
129 | assert_routing( |
|
129 | assert_routing( | |
130 | { :method => 'get', |
|
130 | { :method => 'get', | |
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, |
|
131 | :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" }, | |
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', |
|
132 | { :controller => 'repositories', :action => 'show', :id => 'redmine', | |
133 | :path => @path_hash[:param] , :rev => '2457'} |
|
133 | :path => @path_hash[:param] , :rev => '2457'} | |
134 | ) |
|
134 | ) | |
135 | assert_routing( |
|
135 | assert_routing( | |
136 | { :method => 'get', |
|
136 | { :method => 'get', | |
137 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
137 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
138 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
138 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
139 | :rev => '2457' } |
|
139 | :rev => '2457' } | |
140 | ) |
|
140 | ) | |
141 | assert_routing( |
|
141 | assert_routing( | |
142 | { :method => 'get', |
|
142 | { :method => 'get', | |
143 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
143 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
144 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
144 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
145 | :rev => '2457', :format => 'diff' }, |
|
145 | :rev => '2457', :format => 'diff' }, | |
146 | {}, |
|
146 | {}, | |
147 | { :format => 'diff' } |
|
147 | { :format => 'diff' } | |
148 | ) |
|
148 | ) | |
149 | assert_routing( |
|
149 | assert_routing( | |
150 | { :method => 'get', |
|
150 | { :method => 'get', | |
151 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, |
|
151 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, | |
152 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
152 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
153 | :path => @path_hash[:param], :rev => '2' } |
|
153 | :path => @path_hash[:param], :rev => '2' } | |
154 | ) |
|
154 | ) | |
155 | assert_routing( |
|
155 | assert_routing( | |
156 | { :method => 'get', |
|
156 | { :method => 'get', | |
157 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, |
|
157 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, | |
158 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
158 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
159 | :path => @path_hash[:param], :rev => '2', :format => 'diff' }, |
|
159 | :path => @path_hash[:param], :rev => '2', :format => 'diff' }, | |
160 | {}, |
|
160 | {}, | |
161 | { :format => 'diff' } |
|
161 | { :format => 'diff' } | |
162 | ) |
|
162 | ) | |
163 | assert_routing( |
|
163 | assert_routing( | |
164 | { :method => 'get', |
|
164 | { :method => 'get', | |
165 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, |
|
165 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, | |
166 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
166 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
167 | :path => @path_hash[:param], :rev => '2' } |
|
167 | :path => @path_hash[:param], :rev => '2' } | |
168 | ) |
|
168 | ) | |
169 | assert_routing( |
|
169 | assert_routing( | |
170 | { :method => 'get', |
|
170 | { :method => 'get', | |
171 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, |
|
171 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, | |
172 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', |
|
172 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', | |
173 | :path => @path_hash[:param], :rev => '2' } |
|
173 | :path => @path_hash[:param], :rev => '2' } | |
174 | ) |
|
174 | ) | |
175 | assert_routing( |
|
175 | assert_routing( | |
176 | { :method => 'get', |
|
176 | { :method => 'get', | |
177 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
177 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, | |
178 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
178 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
179 | :path => @path_hash[:param], :rev => '2' } |
|
179 | :path => @path_hash[:param], :rev => '2' } | |
180 | ) |
|
180 | ) | |
181 | end |
|
181 | end | |
182 |
|
182 | |||
183 | def test_repositories_revisions_with_repository_id |
|
183 | def test_repositories_revisions_with_repository_id | |
184 | empty_path_param = [] |
|
184 | empty_path_param = [] | |
185 | assert_routing( |
|
185 | assert_routing( | |
186 | { :method => 'get', |
|
186 | { :method => 'get', | |
187 | :path => "/projects/redmine/repository/foo/revisions" }, |
|
187 | :path => "/projects/redmine/repository/foo/revisions" }, | |
188 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } |
|
188 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } | |
189 | ) |
|
189 | ) | |
190 | assert_routing( |
|
190 | assert_routing( | |
191 | { :method => 'get', |
|
191 | { :method => 'get', | |
192 | :path => "/projects/redmine/repository/foo/revisions.atom" }, |
|
192 | :path => "/projects/redmine/repository/foo/revisions.atom" }, | |
193 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', |
|
193 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', | |
194 | :format => 'atom' } |
|
194 | :format => 'atom' } | |
195 | ) |
|
195 | ) | |
196 | assert_routing( |
|
196 | assert_routing( | |
197 | { :method => 'get', |
|
197 | { :method => 'get', | |
198 | :path => "/projects/redmine/repository/foo/revisions/2457" }, |
|
198 | :path => "/projects/redmine/repository/foo/revisions/2457" }, | |
199 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', |
|
199 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', | |
200 | :rev => '2457' } |
|
200 | :rev => '2457' } | |
201 | ) |
|
201 | ) | |
202 | assert_routing( |
|
202 | assert_routing( | |
203 | { :method => 'get', |
|
203 | { :method => 'get', | |
204 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, |
|
204 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, | |
205 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
205 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
206 | :rev => '2457' } |
|
206 | :rev => '2457' } | |
207 | ) |
|
207 | ) | |
208 | assert_routing( |
|
208 | assert_routing( | |
209 | { :method => 'get', |
|
209 | { :method => 'get', | |
210 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, |
|
210 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, | |
211 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
211 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
212 | :path => @path_hash[:param] , :rev => '2457'} |
|
212 | :path => @path_hash[:param] , :rev => '2457'} | |
213 | ) |
|
213 | ) | |
214 | assert_routing( |
|
214 | assert_routing( | |
215 | { :method => 'get', |
|
215 | { :method => 'get', | |
216 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |
|
216 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, | |
217 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
217 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
218 | :rev => '2457' } |
|
218 | :rev => '2457' } | |
219 | ) |
|
219 | ) | |
220 | assert_routing( |
|
220 | assert_routing( | |
221 | { :method => 'get', |
|
221 | { :method => 'get', | |
222 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |
|
222 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, | |
223 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
223 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
224 | :rev => '2457', :format => 'diff' }, |
|
224 | :rev => '2457', :format => 'diff' }, | |
225 | {}, |
|
225 | {}, | |
226 | { :format => 'diff' } |
|
226 | { :format => 'diff' } | |
227 | ) |
|
227 | ) | |
228 | assert_routing( |
|
228 | assert_routing( | |
229 | { :method => 'get', |
|
229 | { :method => 'get', | |
230 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, |
|
230 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, | |
231 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
231 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
232 | :path => @path_hash[:param], :rev => '2' } |
|
232 | :path => @path_hash[:param], :rev => '2' } | |
233 | ) |
|
233 | ) | |
234 | assert_routing( |
|
234 | assert_routing( | |
235 | { :method => 'get', |
|
235 | { :method => 'get', | |
236 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, |
|
236 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, | |
237 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
237 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
238 | :path => @path_hash[:param], :rev => '2', :format => 'diff' }, |
|
238 | :path => @path_hash[:param], :rev => '2', :format => 'diff' }, | |
239 | {}, |
|
239 | {}, | |
240 | { :format => 'diff' } |
|
240 | { :format => 'diff' } | |
241 | ) |
|
241 | ) | |
242 | assert_routing( |
|
242 | assert_routing( | |
243 | { :method => 'get', |
|
243 | { :method => 'get', | |
244 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, |
|
244 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, | |
245 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
245 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
246 | :path => @path_hash[:param], :rev => '2' } |
|
246 | :path => @path_hash[:param], :rev => '2' } | |
247 | ) |
|
247 | ) | |
248 | assert_routing( |
|
248 | assert_routing( | |
249 | { :method => 'get', |
|
249 | { :method => 'get', | |
250 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, |
|
250 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, | |
251 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', |
|
251 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', | |
252 | :path => @path_hash[:param], :rev => '2' } |
|
252 | :path => @path_hash[:param], :rev => '2' } | |
253 | ) |
|
253 | ) | |
254 | assert_routing( |
|
254 | assert_routing( | |
255 | { :method => 'get', |
|
255 | { :method => 'get', | |
256 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
256 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, | |
257 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
257 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
258 | :path => @path_hash[:param], :rev => '2' } |
|
258 | :path => @path_hash[:param], :rev => '2' } | |
259 | ) |
|
259 | ) | |
260 | end |
|
260 | end | |
261 |
|
261 | |||
262 | def test_repositories_non_revisions_path |
|
262 | def test_repositories_non_revisions_path | |
263 | assert_routing( |
|
263 | assert_routing( | |
264 | { :method => 'get', |
|
264 | { :method => 'get', | |
265 | :path => "/projects/redmine/repository/changes" }, |
|
265 | :path => "/projects/redmine/repository/changes" }, | |
266 | { :controller => 'repositories', :action => 'changes', :id => 'redmine' } |
|
266 | { :controller => 'repositories', :action => 'changes', :id => 'redmine' } | |
267 | ) |
|
267 | ) | |
268 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
268 | ['2457', 'master', 'slash/slash'].each do |rev| | |
269 | assert_routing( |
|
269 | assert_routing( | |
270 | { :method => 'get', |
|
270 | { :method => 'get', | |
271 | :path => "/projects/redmine/repository/changes" }, |
|
271 | :path => "/projects/redmine/repository/changes" }, | |
272 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
272 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
273 | :rev => rev }, |
|
273 | :rev => rev }, | |
274 | {}, |
|
274 | {}, | |
275 | { :rev => rev } |
|
275 | { :rev => rev } | |
276 | ) |
|
276 | ) | |
277 | end |
|
277 | end | |
278 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
278 | ['2457', 'master', 'slash/slash'].each do |rev| | |
279 | assert_routing( |
|
279 | assert_routing( | |
280 | { :method => 'get', |
|
280 | { :method => 'get', | |
281 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
281 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
282 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
282 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
283 | :path => @path_hash[:param], :rev => rev }, |
|
283 | :path => @path_hash[:param], :rev => rev }, | |
284 | {}, |
|
284 | {}, | |
285 | { :rev => rev } |
|
285 | { :rev => rev } | |
286 | ) |
|
286 | ) | |
287 | end |
|
287 | end | |
288 | assert_routing( |
|
288 | assert_routing( | |
289 | { :method => 'get', |
|
289 | { :method => 'get', | |
290 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, |
|
290 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, | |
291 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
291 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
292 | :path => @path_hash[:param] } |
|
292 | :path => @path_hash[:param] } | |
293 | ) |
|
293 | ) | |
294 | assert_routing( |
|
294 | assert_routing( | |
295 | { :method => 'get', |
|
295 | { :method => 'get', | |
296 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, |
|
296 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, | |
297 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
297 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', | |
298 | :path => @path_hash[:param] } |
|
298 | :path => @path_hash[:param] } | |
299 | ) |
|
299 | ) | |
300 | assert_routing( |
|
300 | assert_routing( | |
301 | { :method => 'get', |
|
301 | { :method => 'get', | |
302 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, |
|
302 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, | |
303 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
303 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
304 | :path => @path_hash[:param] } |
|
304 | :path => @path_hash[:param] } | |
305 | ) |
|
305 | ) | |
306 | assert_routing( |
|
306 | assert_routing( | |
307 | { :method => 'get', |
|
307 | { :method => 'get', | |
308 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, |
|
308 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, | |
309 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', |
|
309 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', | |
310 | :path => @path_hash[:param] } |
|
310 | :path => @path_hash[:param] } | |
311 | ) |
|
311 | ) | |
312 | assert_routing( |
|
312 | assert_routing( | |
313 | { :method => 'get', |
|
313 | { :method => 'get', | |
314 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, |
|
314 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, | |
315 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
315 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
316 | :path => @path_hash[:param] } |
|
316 | :path => @path_hash[:param] } | |
317 | ) |
|
317 | ) | |
318 | assert_routing( |
|
318 | assert_routing( | |
319 | { :method => 'get', |
|
319 | { :method => 'get', | |
320 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
320 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
321 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
321 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
322 | :path => @path_hash[:param] } |
|
322 | :path => @path_hash[:param] } | |
323 | ) |
|
323 | ) | |
324 | ["get", "post"].each do |method| |
|
324 | assert_routing( | |
325 | assert_routing( |
|
325 | { :method => 'get', | |
326 | { :method => method, |
|
326 | :path => "/projects/redmine/repository/revision" }, | |
327 | :path => "/projects/redmine/repository/revision" }, |
|
327 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } | |
328 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } |
|
328 | ) | |
329 | ) |
|
|||
330 | end |
|
|||
331 | end |
|
329 | end | |
332 |
|
330 | |||
333 | def test_repositories_non_revisions_path_with_repository_id |
|
331 | def test_repositories_non_revisions_path_with_repository_id | |
334 | assert_routing( |
|
332 | assert_routing( | |
335 | { :method => 'get', |
|
333 | { :method => 'get', | |
336 | :path => "/projects/redmine/repository/foo/changes" }, |
|
334 | :path => "/projects/redmine/repository/foo/changes" }, | |
337 | { :controller => 'repositories', :action => 'changes', |
|
335 | { :controller => 'repositories', :action => 'changes', | |
338 | :id => 'redmine', :repository_id => 'foo' } |
|
336 | :id => 'redmine', :repository_id => 'foo' } | |
339 | ) |
|
337 | ) | |
340 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
338 | ['2457', 'master', 'slash/slash'].each do |rev| | |
341 | assert_routing( |
|
339 | assert_routing( | |
342 | { :method => 'get', |
|
340 | { :method => 'get', | |
343 | :path => "/projects/redmine/repository/foo/changes" }, |
|
341 | :path => "/projects/redmine/repository/foo/changes" }, | |
344 | { :controller => 'repositories', :action => 'changes', |
|
342 | { :controller => 'repositories', :action => 'changes', | |
345 | :id => 'redmine', |
|
343 | :id => 'redmine', | |
346 | :repository_id => 'foo', :rev => rev }, |
|
344 | :repository_id => 'foo', :rev => rev }, | |
347 | {}, |
|
345 | {}, | |
348 | { :rev => rev } |
|
346 | { :rev => rev } | |
349 | ) |
|
347 | ) | |
350 | end |
|
348 | end | |
351 | ['2457', 'master', 'slash/slash'].each do |rev| |
|
349 | ['2457', 'master', 'slash/slash'].each do |rev| | |
352 | assert_routing( |
|
350 | assert_routing( | |
353 | { :method => 'get', |
|
351 | { :method => 'get', | |
354 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
352 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |
355 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
353 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
356 | :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, |
|
354 | :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, | |
357 | {}, |
|
355 | {}, | |
358 | { :rev => rev } |
|
356 | { :rev => rev } | |
359 | ) |
|
357 | ) | |
360 | end |
|
358 | end | |
361 | assert_routing( |
|
359 | assert_routing( | |
362 | { :method => 'get', |
|
360 | { :method => 'get', | |
363 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, |
|
361 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, | |
364 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
362 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
365 | :path => @path_hash[:param] } |
|
363 | :path => @path_hash[:param] } | |
366 | ) |
|
364 | ) | |
367 | assert_routing( |
|
365 | assert_routing( | |
368 | { :method => 'get', |
|
366 | { :method => 'get', | |
369 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, |
|
367 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, | |
370 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', |
|
368 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', | |
371 | :path => @path_hash[:param] } |
|
369 | :path => @path_hash[:param] } | |
372 | ) |
|
370 | ) | |
373 | assert_routing( |
|
371 | assert_routing( | |
374 | { :method => 'get', |
|
372 | { :method => 'get', | |
375 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, |
|
373 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, | |
376 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
374 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
377 | :path => @path_hash[:param] } |
|
375 | :path => @path_hash[:param] } | |
378 | ) |
|
376 | ) | |
379 | assert_routing( |
|
377 | assert_routing( | |
380 | { :method => 'get', |
|
378 | { :method => 'get', | |
381 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, |
|
379 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, | |
382 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', |
|
380 | { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo', | |
383 | :path => @path_hash[:param] } |
|
381 | :path => @path_hash[:param] } | |
384 | ) |
|
382 | ) | |
385 | assert_routing( |
|
383 | assert_routing( | |
386 | { :method => 'get', |
|
384 | { :method => 'get', | |
387 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, |
|
385 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, | |
388 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
386 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
389 | :path => @path_hash[:param] } |
|
387 | :path => @path_hash[:param] } | |
390 | ) |
|
388 | ) | |
391 | assert_routing( |
|
389 | assert_routing( | |
392 | { :method => 'get', |
|
390 | { :method => 'get', | |
393 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
391 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |
394 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
392 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
395 | :path => @path_hash[:param] } |
|
393 | :path => @path_hash[:param] } | |
396 | ) |
|
394 | ) | |
397 | ["get", "post"].each do |method| |
|
395 | assert_routing( | |
398 | assert_routing( |
|
396 | { :method => 'get', | |
399 | { :method => method, |
|
397 | :path => "/projects/redmine/repository/foo/revision" }, | |
400 | :path => "/projects/redmine/repository/foo/revision" }, |
|
398 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} | |
401 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} |
|
399 | ) | |
402 | ) |
|
|||
403 | end |
|
|||
404 | end |
|
400 | end | |
405 |
|
401 | |||
406 | def test_repositories_related_issues |
|
402 | def test_repositories_related_issues | |
407 | assert_routing( |
|
403 | assert_routing( | |
408 | { :method => 'post', |
|
404 | { :method => 'post', | |
409 | :path => "/projects/redmine/repository/revisions/123/issues" }, |
|
405 | :path => "/projects/redmine/repository/revisions/123/issues" }, | |
410 | { :controller => 'repositories', :action => 'add_related_issue', |
|
406 | { :controller => 'repositories', :action => 'add_related_issue', | |
411 | :id => 'redmine', :rev => '123' } |
|
407 | :id => 'redmine', :rev => '123' } | |
412 | ) |
|
408 | ) | |
413 | assert_routing( |
|
409 | assert_routing( | |
414 | { :method => 'delete', |
|
410 | { :method => 'delete', | |
415 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, |
|
411 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, | |
416 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
412 | { :controller => 'repositories', :action => 'remove_related_issue', | |
417 | :id => 'redmine', :rev => '123', :issue_id => '25' } |
|
413 | :id => 'redmine', :rev => '123', :issue_id => '25' } | |
418 | ) |
|
414 | ) | |
419 | end |
|
415 | end | |
420 |
|
416 | |||
421 | def test_repositories_related_issues_with_repository_id |
|
417 | def test_repositories_related_issues_with_repository_id | |
422 | assert_routing( |
|
418 | assert_routing( | |
423 | { :method => 'post', |
|
419 | { :method => 'post', | |
424 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, |
|
420 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, | |
425 | { :controller => 'repositories', :action => 'add_related_issue', |
|
421 | { :controller => 'repositories', :action => 'add_related_issue', | |
426 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } |
|
422 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } | |
427 | ) |
|
423 | ) | |
428 | assert_routing( |
|
424 | assert_routing( | |
429 | { :method => 'delete', |
|
425 | { :method => 'delete', | |
430 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, |
|
426 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, | |
431 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
427 | { :controller => 'repositories', :action => 'remove_related_issue', | |
432 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } |
|
428 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } | |
433 | ) |
|
429 | ) | |
434 | end |
|
430 | end | |
435 | end |
|
431 | end |
General Comments 0
You need to be logged in to leave comments.
Login now