@@ -1,338 +1,344 | |||||
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] |
|
23 | match 'account/register', :to => 'account#register', :via => [:get, :post] | |
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post] |
|
24 | match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post] | |
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' |
|
36 | get 'boards/:board_id/topics/:id', :to => 'messages#show' | |
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 | match 'copy', :via => [:get, :post] |
|
96 | match 'copy', :via => [:get, :post] | |
97 | end |
|
97 | end | |
98 |
|
98 | |||
99 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy] do |
|
99 | resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy] do | |
100 | collection do |
|
100 | collection do | |
101 | get 'autocomplete' |
|
101 | get 'autocomplete' | |
102 | end |
|
102 | end | |
103 | end |
|
103 | end | |
104 |
|
104 | |||
105 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] |
|
105 | resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] | |
106 |
|
106 | |||
107 | match 'issues/:copy_from/copy', :to => 'issues#new' |
|
107 | match 'issues/:copy_from/copy', :to => 'issues#new' | |
108 | resources :issues, :only => [:index, :new, :create] do |
|
108 | resources :issues, :only => [:index, :new, :create] do | |
109 | resources :time_entries, :controller => 'timelog' do |
|
109 | resources :time_entries, :controller => 'timelog' do | |
110 | collection do |
|
110 | collection do | |
111 | get 'report' |
|
111 | get 'report' | |
112 | end |
|
112 | end | |
113 | end |
|
113 | end | |
114 | end |
|
114 | end | |
115 | # issue form update |
|
115 | # issue form update | |
116 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' |
|
116 | match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' | |
117 |
|
117 | |||
118 | resources :files, :only => [:index, :new, :create] |
|
118 | resources :files, :only => [:index, :new, :create] | |
119 |
|
119 | |||
120 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do |
|
120 | resources :versions, :except => [:index, :show, :edit, :update, :destroy] do | |
121 | collection do |
|
121 | collection do | |
122 | put 'close_completed' |
|
122 | put 'close_completed' | |
123 | end |
|
123 | end | |
124 | end |
|
124 | end | |
125 | match 'versions.:format', :to => 'versions#index' |
|
125 | match 'versions.:format', :to => 'versions#index' | |
126 | match 'roadmap', :to => 'versions#index', :format => false |
|
126 | match 'roadmap', :to => 'versions#index', :format => false | |
127 | match 'versions', :to => 'versions#index' |
|
127 | match 'versions', :to => 'versions#index' | |
128 |
|
128 | |||
129 | resources :news, :except => [:show, :edit, :update, :destroy] |
|
129 | resources :news, :except => [:show, :edit, :update, :destroy] | |
130 | resources :time_entries, :controller => 'timelog' do |
|
130 | resources :time_entries, :controller => 'timelog' do | |
131 | get 'report', :on => :collection |
|
131 | get 'report', :on => :collection | |
132 | end |
|
132 | end | |
133 | resources :queries, :only => [:new, :create] |
|
133 | resources :queries, :only => [:new, :create] | |
134 | resources :issue_categories, :shallow => true |
|
134 | resources :issue_categories, :shallow => true | |
135 | resources :documents, :except => [:show, :edit, :update, :destroy] |
|
135 | resources :documents, :except => [:show, :edit, :update, :destroy] | |
136 | resources :boards |
|
136 | resources :boards | |
137 | resources :repositories, :shallow => true, :except => [:index, :show] do |
|
137 | resources :repositories, :shallow => true, :except => [:index, :show] do | |
138 | member do |
|
138 | member do | |
139 | match 'committers', :via => [:get, :post] |
|
139 | match 'committers', :via => [:get, :post] | |
140 | end |
|
140 | end | |
141 | end |
|
141 | end | |
142 |
|
142 | |||
143 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get |
|
143 | match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get | |
144 | match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' |
|
144 | match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' | |
145 | match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff' |
|
145 | match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff' | |
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 | match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' |
|
162 | match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' | |
163 | end |
|
163 | end | |
164 |
|
164 | |||
165 | resources :issues do |
|
165 | resources :issues do | |
166 | collection do |
|
166 | collection do | |
167 | match 'bulk_edit', :via => [:get, :post] |
|
167 | match 'bulk_edit', :via => [:get, :post] | |
168 | post 'bulk_update' |
|
168 | post 'bulk_update' | |
169 | end |
|
169 | end | |
170 | resources :time_entries, :controller => 'timelog' do |
|
170 | resources :time_entries, :controller => 'timelog' do | |
171 | collection do |
|
171 | collection do | |
172 | get 'report' |
|
172 | get 'report' | |
173 | end |
|
173 | end | |
174 | end |
|
174 | end | |
175 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] |
|
175 | resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] | |
176 | end |
|
176 | end | |
177 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete |
|
177 | match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete | |
178 |
|
178 | |||
179 | resources :queries, :except => [:show] |
|
179 | resources :queries, :except => [:show] | |
180 |
|
180 | |||
181 | resources :news, :only => [:index, :show, :edit, :update, :destroy] |
|
181 | resources :news, :only => [:index, :show, :edit, :update, :destroy] | |
182 | match '/news/:id/comments', :to => 'comments#create', :via => :post |
|
182 | match '/news/:id/comments', :to => 'comments#create', :via => :post | |
183 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete |
|
183 | match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete | |
184 |
|
184 | |||
185 | resources :versions, :only => [:show, :edit, :update, :destroy] do |
|
185 | resources :versions, :only => [:show, :edit, :update, :destroy] do | |
186 | post 'status_by', :on => :member |
|
186 | post 'status_by', :on => :member | |
187 | end |
|
187 | end | |
188 |
|
188 | |||
189 | resources :documents, :only => [:show, :edit, :update, :destroy] do |
|
189 | resources :documents, :only => [:show, :edit, :update, :destroy] do | |
190 | post 'add_attachment', :on => :member |
|
190 | post 'add_attachment', :on => :member | |
191 | end |
|
191 | end | |
192 |
|
192 | |||
193 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu |
|
193 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu | |
194 |
|
194 | |||
195 | resources :time_entries, :controller => 'timelog', :except => :destroy do |
|
195 | resources :time_entries, :controller => 'timelog', :except => :destroy do | |
196 | collection do |
|
196 | collection do | |
197 | get 'report' |
|
197 | get 'report' | |
198 | get 'bulk_edit' |
|
198 | get 'bulk_edit' | |
199 | post 'bulk_update' |
|
199 | post 'bulk_update' | |
200 | end |
|
200 | end | |
201 | end |
|
201 | end | |
202 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ |
|
202 | match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ | |
203 | # TODO: delete /time_entries for bulk deletion |
|
203 | # TODO: delete /time_entries for bulk deletion | |
204 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete |
|
204 | match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete | |
205 |
|
205 | |||
206 | # TODO: port to be part of the resources route(s) |
|
206 | # TODO: port to be part of the resources route(s) | |
207 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get |
|
207 | match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get | |
208 |
|
208 | |||
209 | get 'projects/:id/activity', :to => 'activities#index' |
|
209 | get 'projects/:id/activity', :to => 'activities#index' | |
210 | get 'projects/:id/activity.:format', :to => 'activities#index' |
|
210 | get 'projects/:id/activity.:format', :to => 'activities#index' | |
211 | get 'activity', :to => 'activities#index' |
|
211 | get 'activity', :to => 'activities#index' | |
212 |
|
212 | |||
213 | # repositories routes |
|
213 | # repositories routes | |
214 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' |
|
214 | get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' | |
215 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' |
|
215 | get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' | |
216 |
|
216 | |||
|
217 | get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', | |||
|
218 | :to => 'repositories#changes' | |||
|
219 | ||||
217 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' |
|
220 | get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' | |
218 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' |
|
221 | get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' | |
219 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
222 | post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
220 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
223 | delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
221 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' |
|
224 | get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' | |
222 | get 'projects/:id/repository/:repository_id/revisions/:rev/:format(/*path(.:ext))', |
|
225 | get 'projects/:id/repository/:repository_id/revisions/:rev/:format(/*path(.:ext))', | |
223 | :to => 'repositories#entry', |
|
226 | :to => 'repositories#entry', | |
224 | :constraints => { |
|
227 | :constraints => { | |
225 | :format => 'raw', |
|
228 | :format => 'raw', | |
226 | :rev => /[a-z0-9\.\-_]+/ |
|
229 | :rev => /[a-z0-9\.\-_]+/ | |
227 | } |
|
230 | } | |
228 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', |
|
231 | get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', | |
229 | :controller => 'repositories', |
|
232 | :controller => 'repositories', | |
230 | :constraints => { |
|
233 | :constraints => { | |
231 |
:action => /(browse|show|entry| |
|
234 | :action => /(browse|show|entry|annotate|diff)/, | |
232 | :rev => /[a-z0-9\.\-_]+/ |
|
235 | :rev => /[a-z0-9\.\-_]+/ | |
233 | } |
|
236 | } | |
234 |
|
237 | |||
235 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' |
|
238 | get 'projects/:id/repository/statistics', :to => 'repositories#stats' | |
236 | get 'projects/:id/repository/graph', :to => 'repositories#graph' |
|
239 | get 'projects/:id/repository/graph', :to => 'repositories#graph' | |
237 |
|
240 | |||
|
241 | get 'projects/:id/repository/changes(/*path(.:ext))', | |||
|
242 | :to => 'repositories#changes' | |||
|
243 | ||||
238 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' |
|
244 | get 'projects/:id/repository/revisions', :to => 'repositories#revisions' | |
239 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' |
|
245 | get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' | |
240 | get 'projects/:id/repository/revision', :to => 'repositories#revision' |
|
246 | get 'projects/:id/repository/revision', :to => 'repositories#revision' | |
241 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' |
|
247 | post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' | |
242 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' |
|
248 | delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' | |
243 | get 'projects/:id/repository/revisions/:rev/:format(/*path(.:ext))', |
|
249 | get 'projects/:id/repository/revisions/:rev/:format(/*path(.:ext))', | |
244 | :to => 'repositories#entry', |
|
250 | :to => 'repositories#entry', | |
245 | :constraints => { |
|
251 | :constraints => { | |
246 | :format => 'raw', |
|
252 | :format => 'raw', | |
247 | :rev => /[a-z0-9\.\-_]+/ |
|
253 | :rev => /[a-z0-9\.\-_]+/ | |
248 | } |
|
254 | } | |
249 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', |
|
255 | get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', | |
250 | :controller => 'repositories', |
|
256 | :controller => 'repositories', | |
251 | :constraints => { |
|
257 | :constraints => { | |
252 |
:action => /(browse|show|entry| |
|
258 | :action => /(browse|show|entry|annotate|diff)/, | |
253 | :rev => /[a-z0-9\.\-_]+/ |
|
259 | :rev => /[a-z0-9\.\-_]+/ | |
254 | } |
|
260 | } | |
255 | get 'projects/:id/repository/:repository_id/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ |
|
261 | get 'projects/:id/repository/:repository_id/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ | |
256 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ |
|
262 | get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ | |
257 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil |
|
263 | get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil | |
258 |
|
264 | |||
259 | get 'projects/:id/repository/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ |
|
265 | get 'projects/:id/repository/:format(/*path(.:ext))', :to => 'repositories#entry', :format => /raw/ | |
260 | get 'projects/:id/repository/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ |
|
266 | get 'projects/:id/repository/:action(/*path(.:ext))', :controller => 'repositories', :action => /(browse|show|entry|changes|annotate|diff)/ | |
261 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil |
|
267 | get 'projects/:id/repository', :to => 'repositories#show', :path => nil | |
262 |
|
268 | |||
263 | # additional routes for having the file name at the end of url |
|
269 | # additional routes for having the file name at the end of url | |
264 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get |
|
270 | match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get | |
265 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get |
|
271 | match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get | |
266 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get |
|
272 | match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get | |
267 | resources :attachments, :only => [:show, :destroy] |
|
273 | resources :attachments, :only => [:show, :destroy] | |
268 |
|
274 | |||
269 | resources :groups do |
|
275 | resources :groups do | |
270 | member do |
|
276 | member do | |
271 | get 'autocomplete_for_user' |
|
277 | get 'autocomplete_for_user' | |
272 | end |
|
278 | end | |
273 | end |
|
279 | end | |
274 |
|
280 | |||
275 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' |
|
281 | match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' | |
276 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' |
|
282 | match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' | |
277 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post |
|
283 | match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post | |
278 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post |
|
284 | match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post | |
279 |
|
285 | |||
280 | resources :trackers, :except => :show |
|
286 | resources :trackers, :except => :show | |
281 | resources :issue_statuses, :except => :show do |
|
287 | resources :issue_statuses, :except => :show do | |
282 | collection do |
|
288 | collection do | |
283 | post 'update_issue_done_ratio' |
|
289 | post 'update_issue_done_ratio' | |
284 | end |
|
290 | end | |
285 | end |
|
291 | end | |
286 | resources :custom_fields, :except => :show |
|
292 | resources :custom_fields, :except => :show | |
287 | resources :roles, :except => :show do |
|
293 | resources :roles, :except => :show do | |
288 | collection do |
|
294 | collection do | |
289 | match 'permissions', :via => [:get, :post] |
|
295 | match 'permissions', :via => [:get, :post] | |
290 | end |
|
296 | end | |
291 | end |
|
297 | end | |
292 | resources :enumerations, :except => :show |
|
298 | resources :enumerations, :except => :show | |
293 |
|
299 | |||
294 | get 'projects/:id/search', :controller => 'search', :action => 'index' |
|
300 | get 'projects/:id/search', :controller => 'search', :action => 'index' | |
295 | get 'search', :controller => 'search', :action => 'index' |
|
301 | get 'search', :controller => 'search', :action => 'index' | |
296 |
|
302 | |||
297 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post |
|
303 | match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post | |
298 |
|
304 | |||
299 | match 'admin', :controller => 'admin', :action => 'index', :via => :get |
|
305 | match 'admin', :controller => 'admin', :action => 'index', :via => :get | |
300 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get |
|
306 | match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get | |
301 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get |
|
307 | match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get | |
302 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get |
|
308 | match 'admin/info', :controller => 'admin', :action => 'info', :via => :get | |
303 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get |
|
309 | match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get | |
304 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post |
|
310 | match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post | |
305 |
|
311 | |||
306 | resources :auth_sources do |
|
312 | resources :auth_sources do | |
307 | member do |
|
313 | member do | |
308 | get 'test_connection' |
|
314 | get 'test_connection' | |
309 | end |
|
315 | end | |
310 | end |
|
316 | end | |
311 |
|
317 | |||
312 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get |
|
318 | match 'workflows', :controller => 'workflows', :action => 'index', :via => :get | |
313 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] |
|
319 | match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] | |
314 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] |
|
320 | match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] | |
315 | match 'settings', :controller => 'settings', :action => 'index', :via => :get |
|
321 | match 'settings', :controller => 'settings', :action => 'index', :via => :get | |
316 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] |
|
322 | match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] | |
317 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] |
|
323 | match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] | |
318 |
|
324 | |||
319 | match 'sys/projects', :to => 'sys#projects', :via => :get |
|
325 | match 'sys/projects', :to => 'sys#projects', :via => :get | |
320 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post |
|
326 | match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post | |
321 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get |
|
327 | match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get | |
322 |
|
328 | |||
323 | match 'uploads', :to => 'attachments#upload', :via => :post |
|
329 | match 'uploads', :to => 'attachments#upload', :via => :post | |
324 |
|
330 | |||
325 | get 'robots.txt', :to => 'welcome#robots' |
|
331 | get 'robots.txt', :to => 'welcome#robots' | |
326 |
|
332 | |||
327 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| |
|
333 | Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| | |
328 | file = File.join(plugin_dir, "config/routes.rb") |
|
334 | file = File.join(plugin_dir, "config/routes.rb") | |
329 | if File.exists?(file) |
|
335 | if File.exists?(file) | |
330 | begin |
|
336 | begin | |
331 | instance_eval File.read(file) |
|
337 | instance_eval File.read(file) | |
332 | rescue Exception => e |
|
338 | rescue Exception => e | |
333 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." |
|
339 | puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." | |
334 | exit 1 |
|
340 | exit 1 | |
335 | end |
|
341 | end | |
336 | end |
|
342 | end | |
337 | end |
|
343 | end | |
338 | end |
|
344 | end |
@@ -1,383 +1,409 | |||||
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/ |
|
137 | :path => "/projects/redmine/repository/changes" }, | |
|
138 | { :controller => 'repositories', :action => 'changes', :id => 'redmine' } | |||
|
139 | ) | |||
|
140 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
141 | assert_routing( | |||
|
142 | { :method => 'get', | |||
|
143 | :path => "/projects/redmine/repository/changes" }, | |||
138 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
144 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
139 |
:rev => |
|
145 | :rev => rev }, | |
|
146 | {}, | |||
|
147 | { :rev => rev } | |||
140 | ) |
|
148 | ) | |
|
149 | end | |||
|
150 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
141 | assert_routing( |
|
151 | assert_routing( | |
142 | { :method => 'get', |
|
152 | { :method => 'get', | |
143 |
:path => "/projects/redmine/repository/ |
|
153 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
144 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
154 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
145 |
:path => @path_hash[:param] |
|
155 | :path => @path_hash[:param], :rev => rev }, | |
|
156 | {}, | |||
|
157 | { :rev => rev } | |||
146 | ) |
|
158 | ) | |
|
159 | end | |||
147 | assert_routing( |
|
160 | assert_routing( | |
148 | { :method => 'get', |
|
161 | { :method => 'get', | |
149 | :path => "/projects/redmine/repository/revisions/2457/diff" }, |
|
162 | :path => "/projects/redmine/repository/revisions/2457/diff" }, | |
150 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
163 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
151 | :rev => '2457' } |
|
164 | :rev => '2457' } | |
152 | ) |
|
165 | ) | |
153 | assert_routing( |
|
166 | assert_routing( | |
154 | { :method => 'get', |
|
167 | { :method => 'get', | |
155 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, |
|
168 | :path => "/projects/redmine/repository/revisions/2457/diff.diff" }, | |
156 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
169 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
157 | :rev => '2457', :format => 'diff' } |
|
170 | :rev => '2457', :format => 'diff' } | |
158 | ) |
|
171 | ) | |
159 | assert_routing( |
|
172 | assert_routing( | |
160 | { :method => 'get', |
|
173 | { :method => 'get', | |
161 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, |
|
174 | :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" }, | |
162 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
175 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
163 | :path => @path_hash[:param], :rev => '2' } |
|
176 | :path => @path_hash[:param], :rev => '2' } | |
164 | ) |
|
177 | ) | |
165 | assert_routing( |
|
178 | assert_routing( | |
166 | { :method => 'get', |
|
179 | { :method => 'get', | |
167 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, |
|
180 | :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, | |
168 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
181 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
169 | :path => @path_hash[:param], :rev => '2' } |
|
182 | :path => @path_hash[:param], :rev => '2' } | |
170 | ) |
|
183 | ) | |
171 | assert_routing( |
|
184 | assert_routing( | |
172 | { :method => 'get', |
|
185 | { :method => 'get', | |
173 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, |
|
186 | :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" }, | |
174 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
187 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
175 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } |
|
188 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } | |
176 | ) |
|
189 | ) | |
177 | assert_routing( |
|
190 | assert_routing( | |
178 | { :method => 'get', |
|
191 | { :method => 'get', | |
179 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
192 | :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" }, | |
180 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
193 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
181 | :path => @path_hash[:param], :rev => '2' } |
|
194 | :path => @path_hash[:param], :rev => '2' } | |
182 | ) |
|
195 | ) | |
183 | end |
|
196 | end | |
184 |
|
197 | |||
185 | def test_repositories_revisions_with_repository_id |
|
198 | def test_repositories_revisions_with_repository_id | |
186 | empty_path_param = [] |
|
199 | empty_path_param = [] | |
187 | assert_routing( |
|
200 | assert_routing( | |
188 | { :method => 'get', |
|
201 | { :method => 'get', | |
189 | :path => "/projects/redmine/repository/foo/revisions" }, |
|
202 | :path => "/projects/redmine/repository/foo/revisions" }, | |
190 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } |
|
203 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' } | |
191 | ) |
|
204 | ) | |
192 | assert_routing( |
|
205 | assert_routing( | |
193 | { :method => 'get', |
|
206 | { :method => 'get', | |
194 | :path => "/projects/redmine/repository/foo/revisions.atom" }, |
|
207 | :path => "/projects/redmine/repository/foo/revisions.atom" }, | |
195 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', |
|
208 | { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo', | |
196 | :format => 'atom' } |
|
209 | :format => 'atom' } | |
197 | ) |
|
210 | ) | |
198 | assert_routing( |
|
211 | assert_routing( | |
199 | { :method => 'get', |
|
212 | { :method => 'get', | |
200 | :path => "/projects/redmine/repository/foo/revisions/2457" }, |
|
213 | :path => "/projects/redmine/repository/foo/revisions/2457" }, | |
201 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', |
|
214 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo', | |
202 | :rev => '2457' } |
|
215 | :rev => '2457' } | |
203 | ) |
|
216 | ) | |
204 | assert_routing( |
|
217 | assert_routing( | |
205 | { :method => 'get', |
|
218 | { :method => 'get', | |
206 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, |
|
219 | :path => "/projects/redmine/repository/foo/revisions/2457/show" }, | |
207 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
220 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
208 | :rev => '2457' } |
|
221 | :rev => '2457' } | |
209 | ) |
|
222 | ) | |
210 | assert_routing( |
|
223 | assert_routing( | |
211 | { :method => 'get', |
|
224 | { :method => 'get', | |
212 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, |
|
225 | :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" }, | |
213 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', |
|
226 | { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo', | |
214 | :path => @path_hash[:param] , :rev => '2457'} |
|
227 | :path => @path_hash[:param] , :rev => '2457'} | |
215 | ) |
|
228 | ) | |
216 | assert_routing( |
|
229 | assert_routing( | |
217 | { :method => 'get', |
|
230 | { :method => 'get', | |
218 |
:path => "/projects/redmine/repository/foo/ |
|
231 | :path => "/projects/redmine/repository/foo/changes" }, | |
219 |
{ :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo' |
|
232 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo' } | |
220 | :rev => '2457' } |
|
|||
221 | ) |
|
233 | ) | |
|
234 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
222 | assert_routing( |
|
235 | assert_routing( | |
223 | { :method => 'get', |
|
236 | { :method => 'get', | |
224 |
:path => "/projects/redmine/repository/foo/ |
|
237 | :path => "/projects/redmine/repository/foo/changes" }, | |
225 |
{ :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
238 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
226 | :path => @path_hash[:param] , :rev => '2457'} |
|
239 | :repository_id => 'foo', :rev => rev }, | |
|
240 | {}, | |||
|
241 | { :rev => rev } | |||
|
242 | ) | |||
|
243 | end | |||
|
244 | ['2457', 'master', 'slash/slash'].each do |rev| | |||
|
245 | assert_routing( | |||
|
246 | { :method => 'get', | |||
|
247 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |||
|
248 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |||
|
249 | :repository_id => 'foo', :path => @path_hash[:param], :rev => rev }, | |||
|
250 | {}, | |||
|
251 | { :rev => rev } | |||
227 | ) |
|
252 | ) | |
|
253 | end | |||
228 | assert_routing( |
|
254 | assert_routing( | |
229 | { :method => 'get', |
|
255 | { :method => 'get', | |
230 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, |
|
256 | :path => "/projects/redmine/repository/foo/revisions/2457/diff" }, | |
231 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
257 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
232 | :rev => '2457' } |
|
258 | :rev => '2457' } | |
233 | ) |
|
259 | ) | |
234 | assert_routing( |
|
260 | assert_routing( | |
235 | { :method => 'get', |
|
261 | { :method => 'get', | |
236 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, |
|
262 | :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" }, | |
237 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
263 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
238 | :rev => '2457', :format => 'diff' } |
|
264 | :rev => '2457', :format => 'diff' } | |
239 | ) |
|
265 | ) | |
240 | assert_routing( |
|
266 | assert_routing( | |
241 | { :method => 'get', |
|
267 | { :method => 'get', | |
242 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, |
|
268 | :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" }, | |
243 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
269 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
244 | :path => @path_hash[:param], :rev => '2' } |
|
270 | :path => @path_hash[:param], :rev => '2' } | |
245 | ) |
|
271 | ) | |
246 | assert_routing( |
|
272 | assert_routing( | |
247 | { :method => 'get', |
|
273 | { :method => 'get', | |
248 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, |
|
274 | :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, | |
249 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
275 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
250 | :path => @path_hash[:param], :rev => '2' } |
|
276 | :path => @path_hash[:param], :rev => '2' } | |
251 | ) |
|
277 | ) | |
252 | assert_routing( |
|
278 | assert_routing( | |
253 | { :method => 'get', |
|
279 | { :method => 'get', | |
254 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, |
|
280 | :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" }, | |
255 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
281 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
256 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } |
|
282 | :path => @path_hash[:param], :rev => '2', :format => 'raw' } | |
257 | ) |
|
283 | ) | |
258 | assert_routing( |
|
284 | assert_routing( | |
259 | { :method => 'get', |
|
285 | { :method => 'get', | |
260 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, |
|
286 | :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" }, | |
261 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
287 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
262 | :path => @path_hash[:param], :rev => '2' } |
|
288 | :path => @path_hash[:param], :rev => '2' } | |
263 | ) |
|
289 | ) | |
264 | end |
|
290 | end | |
265 |
|
291 | |||
266 | def test_repositories_non_revisions_path |
|
292 | def test_repositories_non_revisions_path | |
267 | assert_routing( |
|
293 | assert_routing( | |
268 | { :method => 'get', |
|
294 | { :method => 'get', | |
269 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, |
|
295 | :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" }, | |
270 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', |
|
296 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', | |
271 | :path => @path_hash[:param] } |
|
297 | :path => @path_hash[:param] } | |
272 | ) |
|
298 | ) | |
273 | assert_routing( |
|
299 | assert_routing( | |
274 | { :method => 'get', |
|
300 | { :method => 'get', | |
275 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, |
|
301 | :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" }, | |
276 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', |
|
302 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', | |
277 | :path => @path_hash[:param] } |
|
303 | :path => @path_hash[:param] } | |
278 | ) |
|
304 | ) | |
279 | assert_routing( |
|
305 | assert_routing( | |
280 | { :method => 'get', |
|
306 | { :method => 'get', | |
281 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, |
|
307 | :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" }, | |
282 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
308 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
283 | :path => @path_hash[:param] } |
|
309 | :path => @path_hash[:param] } | |
284 | ) |
|
310 | ) | |
285 | assert_routing( |
|
311 | assert_routing( | |
286 | { :method => 'get', |
|
312 | { :method => 'get', | |
287 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, |
|
313 | :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" }, | |
288 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', |
|
314 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', | |
289 | :path => @path_hash[:param], :format => 'raw' } |
|
315 | :path => @path_hash[:param], :format => 'raw' } | |
290 | ) |
|
316 | ) | |
291 | assert_routing( |
|
317 | assert_routing( | |
292 | { :method => 'get', |
|
318 | { :method => 'get', | |
293 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, |
|
319 | :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" }, | |
294 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', |
|
320 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', | |
295 | :path => @path_hash[:param] } |
|
321 | :path => @path_hash[:param] } | |
296 | ) |
|
322 | ) | |
297 | assert_routing( |
|
323 | assert_routing( | |
298 | { :method => 'get', |
|
324 | { :method => 'get', | |
299 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, |
|
325 | :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" }, | |
300 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', |
|
326 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', | |
301 | :path => @path_hash[:param] } |
|
327 | :path => @path_hash[:param] } | |
302 | ) |
|
328 | ) | |
303 | assert_routing( |
|
329 | assert_routing( | |
304 | { :method => 'get', |
|
330 | { :method => 'get', | |
305 | :path => "/projects/redmine/repository/revision" }, |
|
331 | :path => "/projects/redmine/repository/revision" }, | |
306 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } |
|
332 | { :controller => 'repositories', :action => 'revision', :id => 'redmine' } | |
307 | ) |
|
333 | ) | |
308 | end |
|
334 | end | |
309 |
|
335 | |||
310 | def test_repositories_non_revisions_path_with_repository_id |
|
336 | def test_repositories_non_revisions_path_with_repository_id | |
311 | assert_routing( |
|
337 | assert_routing( | |
312 | { :method => 'get', |
|
338 | { :method => 'get', | |
313 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, |
|
339 | :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" }, | |
314 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', |
|
340 | { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', | |
315 | :path => @path_hash[:param] } |
|
341 | :path => @path_hash[:param] } | |
316 | ) |
|
342 | ) | |
317 | assert_routing( |
|
343 | assert_routing( | |
318 | { :method => 'get', |
|
344 | { :method => 'get', | |
319 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, |
|
345 | :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" }, | |
320 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', |
|
346 | { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo', | |
321 | :path => @path_hash[:param] } |
|
347 | :path => @path_hash[:param] } | |
322 | ) |
|
348 | ) | |
323 | assert_routing( |
|
349 | assert_routing( | |
324 | { :method => 'get', |
|
350 | { :method => 'get', | |
325 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, |
|
351 | :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" }, | |
326 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
352 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
327 | :path => @path_hash[:param] } |
|
353 | :path => @path_hash[:param] } | |
328 | ) |
|
354 | ) | |
329 | assert_routing( |
|
355 | assert_routing( | |
330 | { :method => 'get', |
|
356 | { :method => 'get', | |
331 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, |
|
357 | :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" }, | |
332 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', |
|
358 | { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo', | |
333 | :path => @path_hash[:param], :format => 'raw' } |
|
359 | :path => @path_hash[:param], :format => 'raw' } | |
334 | ) |
|
360 | ) | |
335 | assert_routing( |
|
361 | assert_routing( | |
336 | { :method => 'get', |
|
362 | { :method => 'get', | |
337 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, |
|
363 | :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" }, | |
338 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', |
|
364 | { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo', | |
339 | :path => @path_hash[:param] } |
|
365 | :path => @path_hash[:param] } | |
340 | ) |
|
366 | ) | |
341 | assert_routing( |
|
367 | assert_routing( | |
342 | { :method => 'get', |
|
368 | { :method => 'get', | |
343 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, |
|
369 | :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" }, | |
344 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', |
|
370 | { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo', | |
345 | :path => @path_hash[:param] } |
|
371 | :path => @path_hash[:param] } | |
346 | ) |
|
372 | ) | |
347 | assert_routing( |
|
373 | assert_routing( | |
348 | { :method => 'get', |
|
374 | { :method => 'get', | |
349 | :path => "/projects/redmine/repository/foo/revision" }, |
|
375 | :path => "/projects/redmine/repository/foo/revision" }, | |
350 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} |
|
376 | { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'} | |
351 | ) |
|
377 | ) | |
352 | end |
|
378 | end | |
353 |
|
379 | |||
354 | def test_repositories_related_issues |
|
380 | def test_repositories_related_issues | |
355 | assert_routing( |
|
381 | assert_routing( | |
356 | { :method => 'post', |
|
382 | { :method => 'post', | |
357 | :path => "/projects/redmine/repository/revisions/123/issues" }, |
|
383 | :path => "/projects/redmine/repository/revisions/123/issues" }, | |
358 | { :controller => 'repositories', :action => 'add_related_issue', |
|
384 | { :controller => 'repositories', :action => 'add_related_issue', | |
359 | :id => 'redmine', :rev => '123' } |
|
385 | :id => 'redmine', :rev => '123' } | |
360 | ) |
|
386 | ) | |
361 | assert_routing( |
|
387 | assert_routing( | |
362 | { :method => 'delete', |
|
388 | { :method => 'delete', | |
363 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, |
|
389 | :path => "/projects/redmine/repository/revisions/123/issues/25" }, | |
364 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
390 | { :controller => 'repositories', :action => 'remove_related_issue', | |
365 | :id => 'redmine', :rev => '123', :issue_id => '25' } |
|
391 | :id => 'redmine', :rev => '123', :issue_id => '25' } | |
366 | ) |
|
392 | ) | |
367 | end |
|
393 | end | |
368 |
|
394 | |||
369 | def test_repositories_related_issues_with_repository_id |
|
395 | def test_repositories_related_issues_with_repository_id | |
370 | assert_routing( |
|
396 | assert_routing( | |
371 | { :method => 'post', |
|
397 | { :method => 'post', | |
372 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, |
|
398 | :path => "/projects/redmine/repository/foo/revisions/123/issues" }, | |
373 | { :controller => 'repositories', :action => 'add_related_issue', |
|
399 | { :controller => 'repositories', :action => 'add_related_issue', | |
374 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } |
|
400 | :id => 'redmine', :repository_id => 'foo', :rev => '123' } | |
375 | ) |
|
401 | ) | |
376 | assert_routing( |
|
402 | assert_routing( | |
377 | { :method => 'delete', |
|
403 | { :method => 'delete', | |
378 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, |
|
404 | :path => "/projects/redmine/repository/foo/revisions/123/issues/25" }, | |
379 | { :controller => 'repositories', :action => 'remove_related_issue', |
|
405 | { :controller => 'repositories', :action => 'remove_related_issue', | |
380 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } |
|
406 | :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' } | |
381 | ) |
|
407 | ) | |
382 | end |
|
408 | end | |
383 | end |
|
409 | end |
General Comments 0
You need to be logged in to leave comments.
Login now