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