Chris@1296
|
1 # Redmine - project management software
|
Chris@1296
|
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
|
Chris@1296
|
3 #
|
Chris@1296
|
4 # This program is free software; you can redistribute it and/or
|
Chris@1296
|
5 # modify it under the terms of the GNU General Public License
|
Chris@1296
|
6 # as published by the Free Software Foundation; either version 2
|
Chris@1296
|
7 # of the License, or (at your option) any later version.
|
Chris@1296
|
8 #
|
Chris@1296
|
9 # This program is distributed in the hope that it will be useful,
|
Chris@1296
|
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Chris@1296
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Chris@1296
|
12 # GNU General Public License for more details.
|
Chris@1296
|
13 #
|
Chris@1296
|
14 # You should have received a copy of the GNU General Public License
|
Chris@1296
|
15 # along with this program; if not, write to the Free Software
|
Chris@1296
|
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Chris@1296
|
17
|
Chris@1296
|
18 require File.expand_path('../../../test_helper', __FILE__)
|
Chris@1296
|
19
|
Chris@1296
|
20 class RoutingRepositoriesTest < ActionController::IntegrationTest
|
Chris@1296
|
21 def setup
|
Chris@1296
|
22 @path_hash = repository_path_hash(%w[path to file.c])
|
Chris@1296
|
23 assert_equal "path/to/file.c", @path_hash[:path]
|
Chris@1296
|
24 assert_equal "path/to/file.c", @path_hash[:param]
|
Chris@1296
|
25 end
|
Chris@1296
|
26
|
Chris@1296
|
27 def test_repositories_resources
|
Chris@1296
|
28 assert_routing(
|
Chris@1296
|
29 { :method => 'get',
|
Chris@1296
|
30 :path => "/projects/redmine/repositories/new" },
|
Chris@1296
|
31 { :controller => 'repositories', :action => 'new', :project_id => 'redmine' }
|
Chris@1296
|
32 )
|
Chris@1296
|
33 assert_routing(
|
Chris@1296
|
34 { :method => 'post',
|
Chris@1296
|
35 :path => "/projects/redmine/repositories" },
|
Chris@1296
|
36 { :controller => 'repositories', :action => 'create', :project_id => 'redmine' }
|
Chris@1296
|
37 )
|
Chris@1296
|
38 assert_routing(
|
Chris@1296
|
39 { :method => 'get',
|
Chris@1296
|
40 :path => "/repositories/1/edit" },
|
Chris@1296
|
41 { :controller => 'repositories', :action => 'edit', :id => '1' }
|
Chris@1296
|
42 )
|
Chris@1296
|
43 assert_routing(
|
Chris@1296
|
44 { :method => 'put',
|
Chris@1296
|
45 :path => "/repositories/1" },
|
Chris@1296
|
46 { :controller => 'repositories', :action => 'update', :id => '1' }
|
Chris@1296
|
47 )
|
Chris@1296
|
48 assert_routing(
|
Chris@1296
|
49 { :method => 'delete',
|
Chris@1296
|
50 :path => "/repositories/1" },
|
Chris@1296
|
51 { :controller => 'repositories', :action => 'destroy', :id => '1' }
|
Chris@1296
|
52 )
|
Chris@1296
|
53 ["get", "post"].each do |method|
|
Chris@1296
|
54 assert_routing(
|
Chris@1296
|
55 { :method => method,
|
Chris@1296
|
56 :path => "/repositories/1/committers" },
|
Chris@1296
|
57 { :controller => 'repositories', :action => 'committers', :id => '1' }
|
Chris@1296
|
58 )
|
Chris@1296
|
59 end
|
Chris@1296
|
60 end
|
Chris@1296
|
61
|
Chris@1296
|
62 def test_repositories_show
|
Chris@1296
|
63 assert_routing(
|
Chris@1296
|
64 { :method => 'get',
|
Chris@1296
|
65 :path => "/projects/redmine/repository" },
|
Chris@1296
|
66 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
|
Chris@1296
|
67 )
|
Chris@1296
|
68 end
|
Chris@1296
|
69
|
Chris@1296
|
70 def test_repositories
|
Chris@1296
|
71 assert_routing(
|
Chris@1296
|
72 { :method => 'get',
|
Chris@1296
|
73 :path => "/projects/redmine/repository/statistics" },
|
Chris@1296
|
74 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
|
Chris@1296
|
75 )
|
Chris@1296
|
76 assert_routing(
|
Chris@1296
|
77 { :method => 'get',
|
Chris@1296
|
78 :path => "/projects/redmine/repository/graph" },
|
Chris@1296
|
79 { :controller => 'repositories', :action => 'graph', :id => 'redmine' }
|
Chris@1296
|
80 )
|
Chris@1296
|
81 end
|
Chris@1296
|
82
|
Chris@1296
|
83 def test_repositories_show_with_repository_id
|
Chris@1296
|
84 assert_routing(
|
Chris@1296
|
85 { :method => 'get',
|
Chris@1296
|
86 :path => "/projects/redmine/repository/foo" },
|
Chris@1296
|
87 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo' }
|
Chris@1296
|
88 )
|
Chris@1296
|
89 end
|
Chris@1296
|
90
|
Chris@1296
|
91 def test_repositories_with_repository_id
|
Chris@1296
|
92 assert_routing(
|
Chris@1296
|
93 { :method => 'get',
|
Chris@1296
|
94 :path => "/projects/redmine/repository/foo/statistics" },
|
Chris@1296
|
95 { :controller => 'repositories', :action => 'stats', :id => 'redmine', :repository_id => 'foo' }
|
Chris@1296
|
96 )
|
Chris@1296
|
97 assert_routing(
|
Chris@1296
|
98 { :method => 'get',
|
Chris@1296
|
99 :path => "/projects/redmine/repository/foo/graph" },
|
Chris@1296
|
100 { :controller => 'repositories', :action => 'graph', :id => 'redmine', :repository_id => 'foo' }
|
Chris@1296
|
101 )
|
Chris@1296
|
102 end
|
Chris@1296
|
103
|
Chris@1296
|
104 def test_repositories_revisions
|
Chris@1296
|
105 empty_path_param = []
|
Chris@1296
|
106 assert_routing(
|
Chris@1296
|
107 { :method => 'get',
|
Chris@1296
|
108 :path => "/projects/redmine/repository/revisions" },
|
Chris@1296
|
109 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
|
Chris@1296
|
110 )
|
Chris@1296
|
111 assert_routing(
|
Chris@1296
|
112 { :method => 'get',
|
Chris@1296
|
113 :path => "/projects/redmine/repository/revisions.atom" },
|
Chris@1296
|
114 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
|
Chris@1296
|
115 :format => 'atom' }
|
Chris@1296
|
116 )
|
Chris@1296
|
117 assert_routing(
|
Chris@1296
|
118 { :method => 'get',
|
Chris@1296
|
119 :path => "/projects/redmine/repository/revisions/2457" },
|
Chris@1296
|
120 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
|
Chris@1296
|
121 :rev => '2457' }
|
Chris@1296
|
122 )
|
Chris@1296
|
123 assert_routing(
|
Chris@1296
|
124 { :method => 'get',
|
Chris@1296
|
125 :path => "/projects/redmine/repository/revisions/2457/show" },
|
Chris@1296
|
126 { :controller => 'repositories', :action => 'show', :id => 'redmine',
|
Chris@1296
|
127 :rev => '2457' }
|
Chris@1296
|
128 )
|
Chris@1296
|
129 assert_routing(
|
Chris@1296
|
130 { :method => 'get',
|
Chris@1296
|
131 :path => "/projects/redmine/repository/revisions/2457/show/#{@path_hash[:path]}" },
|
Chris@1296
|
132 { :controller => 'repositories', :action => 'show', :id => 'redmine',
|
Chris@1296
|
133 :path => @path_hash[:param] , :rev => '2457'}
|
Chris@1296
|
134 )
|
Chris@1296
|
135 assert_routing(
|
Chris@1296
|
136 { :method => 'get',
|
Chris@1296
|
137 :path => "/projects/redmine/repository/revisions/2457/diff" },
|
Chris@1296
|
138 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
|
Chris@1296
|
139 :rev => '2457' }
|
Chris@1296
|
140 )
|
Chris@1296
|
141 assert_routing(
|
Chris@1296
|
142 { :method => 'get',
|
Chris@1296
|
143 :path => "/projects/redmine/repository/revisions/2457/diff" },
|
Chris@1296
|
144 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
|
Chris@1296
|
145 :rev => '2457', :format => 'diff' },
|
Chris@1296
|
146 {},
|
Chris@1296
|
147 { :format => 'diff' }
|
Chris@1296
|
148 )
|
Chris@1296
|
149 assert_routing(
|
Chris@1296
|
150 { :method => 'get',
|
Chris@1296
|
151 :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
152 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
|
Chris@1296
|
153 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
154 )
|
Chris@1296
|
155 assert_routing(
|
Chris@1296
|
156 { :method => 'get',
|
Chris@1296
|
157 :path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
158 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
|
Chris@1296
|
159 :path => @path_hash[:param], :rev => '2', :format => 'diff' },
|
Chris@1296
|
160 {},
|
Chris@1296
|
161 { :format => 'diff' }
|
Chris@1296
|
162 )
|
Chris@1296
|
163 assert_routing(
|
Chris@1296
|
164 { :method => 'get',
|
Chris@1296
|
165 :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" },
|
Chris@1296
|
166 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
|
Chris@1296
|
167 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
168 )
|
Chris@1296
|
169 assert_routing(
|
Chris@1296
|
170 { :method => 'get',
|
Chris@1296
|
171 :path => "/projects/redmine/repository/revisions/2/raw/#{@path_hash[:path]}" },
|
Chris@1296
|
172 { :controller => 'repositories', :action => 'raw', :id => 'redmine',
|
Chris@1296
|
173 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
174 )
|
Chris@1296
|
175 assert_routing(
|
Chris@1296
|
176 { :method => 'get',
|
Chris@1296
|
177 :path => "/projects/redmine/repository/revisions/2/annotate/#{@path_hash[:path]}" },
|
Chris@1296
|
178 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
|
Chris@1296
|
179 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
180 )
|
Chris@1296
|
181 end
|
Chris@1296
|
182
|
Chris@1296
|
183 def test_repositories_revisions_with_repository_id
|
Chris@1296
|
184 empty_path_param = []
|
Chris@1296
|
185 assert_routing(
|
Chris@1296
|
186 { :method => 'get',
|
Chris@1296
|
187 :path => "/projects/redmine/repository/foo/revisions" },
|
Chris@1296
|
188 { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo' }
|
Chris@1296
|
189 )
|
Chris@1296
|
190 assert_routing(
|
Chris@1296
|
191 { :method => 'get',
|
Chris@1296
|
192 :path => "/projects/redmine/repository/foo/revisions.atom" },
|
Chris@1296
|
193 { :controller => 'repositories', :action => 'revisions', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
194 :format => 'atom' }
|
Chris@1296
|
195 )
|
Chris@1296
|
196 assert_routing(
|
Chris@1296
|
197 { :method => 'get',
|
Chris@1296
|
198 :path => "/projects/redmine/repository/foo/revisions/2457" },
|
Chris@1296
|
199 { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
200 :rev => '2457' }
|
Chris@1296
|
201 )
|
Chris@1296
|
202 assert_routing(
|
Chris@1296
|
203 { :method => 'get',
|
Chris@1296
|
204 :path => "/projects/redmine/repository/foo/revisions/2457/show" },
|
Chris@1296
|
205 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
206 :rev => '2457' }
|
Chris@1296
|
207 )
|
Chris@1296
|
208 assert_routing(
|
Chris@1296
|
209 { :method => 'get',
|
Chris@1296
|
210 :path => "/projects/redmine/repository/foo/revisions/2457/show/#{@path_hash[:path]}" },
|
Chris@1296
|
211 { :controller => 'repositories', :action => 'show', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
212 :path => @path_hash[:param] , :rev => '2457'}
|
Chris@1296
|
213 )
|
Chris@1296
|
214 assert_routing(
|
Chris@1296
|
215 { :method => 'get',
|
Chris@1296
|
216 :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
|
Chris@1296
|
217 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
218 :rev => '2457' }
|
Chris@1296
|
219 )
|
Chris@1296
|
220 assert_routing(
|
Chris@1296
|
221 { :method => 'get',
|
Chris@1296
|
222 :path => "/projects/redmine/repository/foo/revisions/2457/diff" },
|
Chris@1296
|
223 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
224 :rev => '2457', :format => 'diff' },
|
Chris@1296
|
225 {},
|
Chris@1296
|
226 { :format => 'diff' }
|
Chris@1296
|
227 )
|
Chris@1296
|
228 assert_routing(
|
Chris@1296
|
229 { :method => 'get',
|
Chris@1296
|
230 :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
231 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
232 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
233 )
|
Chris@1296
|
234 assert_routing(
|
Chris@1296
|
235 { :method => 'get',
|
Chris@1296
|
236 :path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
237 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
238 :path => @path_hash[:param], :rev => '2', :format => 'diff' },
|
Chris@1296
|
239 {},
|
Chris@1296
|
240 { :format => 'diff' }
|
Chris@1296
|
241 )
|
Chris@1296
|
242 assert_routing(
|
Chris@1296
|
243 { :method => 'get',
|
Chris@1296
|
244 :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" },
|
Chris@1296
|
245 { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
246 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
247 )
|
Chris@1296
|
248 assert_routing(
|
Chris@1296
|
249 { :method => 'get',
|
Chris@1296
|
250 :path => "/projects/redmine/repository/foo/revisions/2/raw/#{@path_hash[:path]}" },
|
Chris@1296
|
251 { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
252 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
253 )
|
Chris@1296
|
254 assert_routing(
|
Chris@1296
|
255 { :method => 'get',
|
Chris@1296
|
256 :path => "/projects/redmine/repository/foo/revisions/2/annotate/#{@path_hash[:path]}" },
|
Chris@1296
|
257 { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
258 :path => @path_hash[:param], :rev => '2' }
|
Chris@1296
|
259 )
|
Chris@1296
|
260 end
|
Chris@1296
|
261
|
Chris@1296
|
262 def test_repositories_non_revisions_path
|
Chris@1296
|
263 assert_routing(
|
Chris@1296
|
264 { :method => 'get',
|
Chris@1296
|
265 :path => "/projects/redmine/repository/changes" },
|
Chris@1296
|
266 { :controller => 'repositories', :action => 'changes', :id => 'redmine' }
|
Chris@1296
|
267 )
|
Chris@1296
|
268 ['2457', 'master', 'slash/slash'].each do |rev|
|
Chris@1296
|
269 assert_routing(
|
Chris@1296
|
270 { :method => 'get',
|
Chris@1296
|
271 :path => "/projects/redmine/repository/changes" },
|
Chris@1296
|
272 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
Chris@1296
|
273 :rev => rev },
|
Chris@1296
|
274 {},
|
Chris@1296
|
275 { :rev => rev }
|
Chris@1296
|
276 )
|
Chris@1296
|
277 end
|
Chris@1296
|
278 ['2457', 'master', 'slash/slash'].each do |rev|
|
Chris@1296
|
279 assert_routing(
|
Chris@1296
|
280 { :method => 'get',
|
Chris@1296
|
281 :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
|
Chris@1296
|
282 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
Chris@1296
|
283 :path => @path_hash[:param], :rev => rev },
|
Chris@1296
|
284 {},
|
Chris@1296
|
285 { :rev => rev }
|
Chris@1296
|
286 )
|
Chris@1296
|
287 end
|
Chris@1296
|
288 assert_routing(
|
Chris@1296
|
289 { :method => 'get',
|
Chris@1296
|
290 :path => "/projects/redmine/repository/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
291 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
|
Chris@1296
|
292 :path => @path_hash[:param] }
|
Chris@1296
|
293 )
|
Chris@1296
|
294 assert_routing(
|
Chris@1296
|
295 { :method => 'get',
|
Chris@1296
|
296 :path => "/projects/redmine/repository/browse/#{@path_hash[:path]}" },
|
Chris@1296
|
297 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
|
Chris@1296
|
298 :path => @path_hash[:param] }
|
Chris@1296
|
299 )
|
Chris@1296
|
300 assert_routing(
|
Chris@1296
|
301 { :method => 'get',
|
Chris@1296
|
302 :path => "/projects/redmine/repository/entry/#{@path_hash[:path]}" },
|
Chris@1296
|
303 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
|
Chris@1296
|
304 :path => @path_hash[:param] }
|
Chris@1296
|
305 )
|
Chris@1296
|
306 assert_routing(
|
Chris@1296
|
307 { :method => 'get',
|
Chris@1296
|
308 :path => "/projects/redmine/repository/raw/#{@path_hash[:path]}" },
|
Chris@1296
|
309 { :controller => 'repositories', :action => 'raw', :id => 'redmine',
|
Chris@1296
|
310 :path => @path_hash[:param] }
|
Chris@1296
|
311 )
|
Chris@1296
|
312 assert_routing(
|
Chris@1296
|
313 { :method => 'get',
|
Chris@1296
|
314 :path => "/projects/redmine/repository/annotate/#{@path_hash[:path]}" },
|
Chris@1296
|
315 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
|
Chris@1296
|
316 :path => @path_hash[:param] }
|
Chris@1296
|
317 )
|
Chris@1296
|
318 assert_routing(
|
Chris@1296
|
319 { :method => 'get',
|
Chris@1296
|
320 :path => "/projects/redmine/repository/changes/#{@path_hash[:path]}" },
|
Chris@1296
|
321 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
Chris@1296
|
322 :path => @path_hash[:param] }
|
Chris@1296
|
323 )
|
Chris@1296
|
324 assert_routing(
|
Chris@1296
|
325 { :method => 'get',
|
Chris@1296
|
326 :path => "/projects/redmine/repository/revision" },
|
Chris@1296
|
327 { :controller => 'repositories', :action => 'revision', :id => 'redmine' }
|
Chris@1296
|
328 )
|
Chris@1296
|
329 end
|
Chris@1296
|
330
|
Chris@1296
|
331 def test_repositories_non_revisions_path_with_repository_id
|
Chris@1296
|
332 assert_routing(
|
Chris@1296
|
333 { :method => 'get',
|
Chris@1296
|
334 :path => "/projects/redmine/repository/foo/changes" },
|
Chris@1296
|
335 { :controller => 'repositories', :action => 'changes',
|
Chris@1296
|
336 :id => 'redmine', :repository_id => 'foo' }
|
Chris@1296
|
337 )
|
Chris@1296
|
338 ['2457', 'master', 'slash/slash'].each do |rev|
|
Chris@1296
|
339 assert_routing(
|
Chris@1296
|
340 { :method => 'get',
|
Chris@1296
|
341 :path => "/projects/redmine/repository/foo/changes" },
|
Chris@1296
|
342 { :controller => 'repositories', :action => 'changes',
|
Chris@1296
|
343 :id => 'redmine',
|
Chris@1296
|
344 :repository_id => 'foo', :rev => rev },
|
Chris@1296
|
345 {},
|
Chris@1296
|
346 { :rev => rev }
|
Chris@1296
|
347 )
|
Chris@1296
|
348 end
|
Chris@1296
|
349 ['2457', 'master', 'slash/slash'].each do |rev|
|
Chris@1296
|
350 assert_routing(
|
Chris@1296
|
351 { :method => 'get',
|
Chris@1296
|
352 :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
|
Chris@1296
|
353 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
|
Chris@1296
|
354 :repository_id => 'foo', :path => @path_hash[:param], :rev => rev },
|
Chris@1296
|
355 {},
|
Chris@1296
|
356 { :rev => rev }
|
Chris@1296
|
357 )
|
Chris@1296
|
358 end
|
Chris@1296
|
359 assert_routing(
|
Chris@1296
|
360 { :method => 'get',
|
Chris@1296
|
361 :path => "/projects/redmine/repository/foo/diff/#{@path_hash[:path]}" },
|
Chris@1296
|
362 { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
363 :path => @path_hash[:param] }
|
Chris@1296
|
364 )
|
Chris@1296
|
365 assert_routing(
|
Chris@1296
|
366 { :method => 'get',
|
Chris@1296
|
367 :path => "/projects/redmine/repository/foo/browse/#{@path_hash[:path]}" },
|
Chris@1296
|
368 { :controller => 'repositories', :action => 'browse', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
369 :path => @path_hash[:param] }
|
Chris@1296
|
370 )
|
Chris@1296
|
371 assert_routing(
|
Chris@1296
|
372 { :method => 'get',
|
Chris@1296
|
373 :path => "/projects/redmine/repository/foo/entry/#{@path_hash[:path]}" },
|
Chris@1296
|
374 { :controller => 'repositories', :action => 'entry', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
375 :path => @path_hash[:param] }
|
Chris@1296
|
376 )
|
Chris@1296
|
377 assert_routing(
|
Chris@1296
|
378 { :method => 'get',
|
Chris@1296
|
379 :path => "/projects/redmine/repository/foo/raw/#{@path_hash[:path]}" },
|
Chris@1296
|
380 { :controller => 'repositories', :action => 'raw', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
381 :path => @path_hash[:param] }
|
Chris@1296
|
382 )
|
Chris@1296
|
383 assert_routing(
|
Chris@1296
|
384 { :method => 'get',
|
Chris@1296
|
385 :path => "/projects/redmine/repository/foo/annotate/#{@path_hash[:path]}" },
|
Chris@1296
|
386 { :controller => 'repositories', :action => 'annotate', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
387 :path => @path_hash[:param] }
|
Chris@1296
|
388 )
|
Chris@1296
|
389 assert_routing(
|
Chris@1296
|
390 { :method => 'get',
|
Chris@1296
|
391 :path => "/projects/redmine/repository/foo/changes/#{@path_hash[:path]}" },
|
Chris@1296
|
392 { :controller => 'repositories', :action => 'changes', :id => 'redmine', :repository_id => 'foo',
|
Chris@1296
|
393 :path => @path_hash[:param] }
|
Chris@1296
|
394 )
|
Chris@1296
|
395 assert_routing(
|
Chris@1296
|
396 { :method => 'get',
|
Chris@1296
|
397 :path => "/projects/redmine/repository/foo/revision" },
|
Chris@1296
|
398 { :controller => 'repositories', :action => 'revision', :id => 'redmine', :repository_id => 'foo'}
|
Chris@1296
|
399 )
|
Chris@1296
|
400 end
|
Chris@1296
|
401
|
Chris@1296
|
402 def test_repositories_related_issues
|
Chris@1296
|
403 assert_routing(
|
Chris@1296
|
404 { :method => 'post',
|
Chris@1296
|
405 :path => "/projects/redmine/repository/revisions/123/issues" },
|
Chris@1296
|
406 { :controller => 'repositories', :action => 'add_related_issue',
|
Chris@1296
|
407 :id => 'redmine', :rev => '123' }
|
Chris@1296
|
408 )
|
Chris@1296
|
409 assert_routing(
|
Chris@1296
|
410 { :method => 'delete',
|
Chris@1296
|
411 :path => "/projects/redmine/repository/revisions/123/issues/25" },
|
Chris@1296
|
412 { :controller => 'repositories', :action => 'remove_related_issue',
|
Chris@1296
|
413 :id => 'redmine', :rev => '123', :issue_id => '25' }
|
Chris@1296
|
414 )
|
Chris@1296
|
415 end
|
Chris@1296
|
416
|
Chris@1296
|
417 def test_repositories_related_issues_with_repository_id
|
Chris@1296
|
418 assert_routing(
|
Chris@1296
|
419 { :method => 'post',
|
Chris@1296
|
420 :path => "/projects/redmine/repository/foo/revisions/123/issues" },
|
Chris@1296
|
421 { :controller => 'repositories', :action => 'add_related_issue',
|
Chris@1296
|
422 :id => 'redmine', :repository_id => 'foo', :rev => '123' }
|
Chris@1296
|
423 )
|
Chris@1296
|
424 assert_routing(
|
Chris@1296
|
425 { :method => 'delete',
|
Chris@1296
|
426 :path => "/projects/redmine/repository/foo/revisions/123/issues/25" },
|
Chris@1296
|
427 { :controller => 'repositories', :action => 'remove_related_issue',
|
Chris@1296
|
428 :id => 'redmine', :repository_id => 'foo', :rev => '123', :issue_id => '25' }
|
Chris@1296
|
429 )
|
Chris@1296
|
430 end
|
Chris@1296
|
431 end
|