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