##// END OF EJS Templates
Rails3: test: scm: mercurial: use "repository_path_hash" for path param...
Toshi MARUYAMA -
r8816:9774782cab72
parent child
Show More
@@ -92,7 +92,7 class RepositoriesMercurialControllerTest < ActionController::TestCase
92 @repository.fetch_changesets
92 @repository.fetch_changesets
93 @project.reload
93 @project.reload
94 assert_equal NUM_REV, @repository.changesets.count
94 assert_equal NUM_REV, @repository.changesets.count
95 get :show, :id => PRJ_ID, :path => ['images']
95 get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param]
96 assert_response :success
96 assert_response :success
97 assert_template 'show'
97 assert_template 'show'
98 assert_not_nil assigns(:entries)
98 assert_not_nil assigns(:entries)
@@ -111,7 +111,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
111 @project.reload
111 @project.reload
112 assert_equal NUM_REV, @repository.changesets.count
112 assert_equal NUM_REV, @repository.changesets.count
113 [0, '0', '0885933ad4f6'].each do |r1|
113 [0, '0', '0885933ad4f6'].each do |r1|
114 get :show, :id => PRJ_ID, :path => ['images'], :rev => r1
114 get :show, :id => PRJ_ID, :path => repository_path_hash(['images'])[:param],
115 :rev => r1
115 assert_response :success
116 assert_response :success
116 assert_template 'show'
117 assert_template 'show'
117 assert_not_nil assigns(:entries)
118 assert_not_nil assigns(:entries)
@@ -127,7 +128,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
127 @project.reload
128 @project.reload
128 assert_equal NUM_REV, @repository.changesets.count
129 assert_equal NUM_REV, @repository.changesets.count
129 [13, '13', '3a330eb32958'].each do |r1|
130 [13, '13', '3a330eb32958'].each do |r1|
130 get :show, :id => PRJ_ID, :path => ['sql_escape', 'percent%dir'],
131 get :show, :id => PRJ_ID,
132 :path => repository_path_hash(['sql_escape', 'percent%dir'])[:param],
131 :rev => r1
133 :rev => r1
132 assert_response :success
134 assert_response :success
133 assert_template 'show'
135 assert_template 'show'
@@ -148,7 +150,9 class RepositoriesMercurialControllerTest < ActionController::TestCase
148 @project.reload
150 @project.reload
149 assert_equal NUM_REV, @repository.changesets.count
151 assert_equal NUM_REV, @repository.changesets.count
150 [21, '21', 'adf805632193'].each do |r1|
152 [21, '21', 'adf805632193'].each do |r1|
151 get :show, :id => PRJ_ID, :path => ['latin-1-dir'], :rev => r1
153 get :show, :id => PRJ_ID,
154 :path => repository_path_hash(['latin-1-dir'])[:param],
155 :rev => r1
152 assert_response :success
156 assert_response :success
153 assert_template 'show'
157 assert_template 'show'
154
158
@@ -217,14 +221,16 class RepositoriesMercurialControllerTest < ActionController::TestCase
217 end
221 end
218
222
219 def test_changes
223 def test_changes
220 get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
224 get :changes, :id => PRJ_ID,
225 :path => repository_path_hash(['images', 'edit.png'])[:param]
221 assert_response :success
226 assert_response :success
222 assert_template 'changes'
227 assert_template 'changes'
223 assert_tag :tag => 'h2', :content => 'edit.png'
228 assert_tag :tag => 'h2', :content => 'edit.png'
224 end
229 end
225
230
226 def test_entry_show
231 def test_entry_show
227 get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
232 get :entry, :id => PRJ_ID,
233 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
228 assert_response :success
234 assert_response :success
229 assert_template 'entry'
235 assert_template 'entry'
230 # Line 10
236 # Line 10
@@ -237,7 +243,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
237 def test_entry_show_latin_1_path
243 def test_entry_show_latin_1_path
238 [21, '21', 'adf805632193'].each do |r1|
244 [21, '21', 'adf805632193'].each do |r1|
239 get :entry, :id => PRJ_ID,
245 get :entry, :id => PRJ_ID,
240 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
246 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
247 :rev => r1
241 assert_response :success
248 assert_response :success
242 assert_template 'entry'
249 assert_template 'entry'
243 assert_tag :tag => 'th',
250 assert_tag :tag => 'th',
@@ -252,7 +259,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
252 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
259 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
253 [27, '27', '7bbf4c738e71'].each do |r1|
260 [27, '27', '7bbf4c738e71'].each do |r1|
254 get :entry, :id => PRJ_ID,
261 get :entry, :id => PRJ_ID,
255 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
262 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
263 :rev => r1
256 assert_response :success
264 assert_response :success
257 assert_template 'entry'
265 assert_template 'entry'
258 assert_tag :tag => 'th',
266 assert_tag :tag => 'th',
@@ -266,20 +274,23 class RepositoriesMercurialControllerTest < ActionController::TestCase
266
274
267 def test_entry_download
275 def test_entry_download
268 get :entry, :id => PRJ_ID,
276 get :entry, :id => PRJ_ID,
269 :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
277 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
278 :format => 'raw'
270 assert_response :success
279 assert_response :success
271 # File content
280 # File content
272 assert @response.body.include?('WITHOUT ANY WARRANTY')
281 assert @response.body.include?('WITHOUT ANY WARRANTY')
273 end
282 end
274
283
275 def test_entry_binary_force_download
284 def test_entry_binary_force_download
276 get :entry, :id => PRJ_ID, :rev => 1, :path => ['images', 'edit.png']
285 get :entry, :id => PRJ_ID, :rev => 1,
286 :path => repository_path_hash(['images', 'edit.png'])[:param]
277 assert_response :success
287 assert_response :success
278 assert_equal 'image/png', @response.content_type
288 assert_equal 'image/png', @response.content_type
279 end
289 end
280
290
281 def test_directory_entry
291 def test_directory_entry
282 get :entry, :id => PRJ_ID, :path => ['sources']
292 get :entry, :id => PRJ_ID,
293 :path => repository_path_hash(['sources'])[:param]
283 assert_response :success
294 assert_response :success
284 assert_template 'show'
295 assert_template 'show'
285 assert_not_nil assigns(:entry)
296 assert_not_nil assigns(:entry)
@@ -361,7 +372,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
361 end
372 end
362
373
363 def test_annotate
374 def test_annotate
364 get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
375 get :annotate, :id => PRJ_ID,
376 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
365 assert_response :success
377 assert_response :success
366 assert_template 'annotate'
378 assert_template 'annotate'
367 # Line 23, revision 4:def6d2f1254a
379 # Line 23, revision 4:def6d2f1254a
@@ -394,9 +406,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
394 @repository.fetch_changesets
406 @repository.fetch_changesets
395 @project.reload
407 @project.reload
396 assert_equal NUM_REV, @repository.changesets.count
408 assert_equal NUM_REV, @repository.changesets.count
397
398 get :annotate, :id => PRJ_ID,
409 get :annotate, :id => PRJ_ID,
399 :path => ['sources', 'welcome_controller.rb']
410 :path => repository_path_hash(['sources', 'welcome_controller.rb'])[:param]
400 assert_response 404
411 assert_response 404
401 assert_error_tag :content => /was not found/
412 assert_error_tag :content => /was not found/
402 end
413 end
@@ -408,7 +419,7 class RepositoriesMercurialControllerTest < ActionController::TestCase
408 assert_equal NUM_REV, @repository.changesets.count
419 assert_equal NUM_REV, @repository.changesets.count
409 [2, '400bb8672109', '400', 400].each do |r1|
420 [2, '400bb8672109', '400', 400].each do |r1|
410 get :annotate, :id => PRJ_ID, :rev => r1,
421 get :annotate, :id => PRJ_ID, :rev => r1,
411 :path => ['sources', 'watchers_controller.rb']
422 :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
412 assert_response :success
423 assert_response :success
413 assert_template 'annotate'
424 assert_template 'annotate'
414 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
425 assert_tag :tag => 'h2', :content => /@ 2:400bb8672109/
@@ -418,7 +429,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
418 def test_annotate_latin_1_path
429 def test_annotate_latin_1_path
419 [21, '21', 'adf805632193'].each do |r1|
430 [21, '21', 'adf805632193'].each do |r1|
420 get :annotate, :id => PRJ_ID,
431 get :annotate, :id => PRJ_ID,
421 :path => ['latin-1-dir', "test-#{@char_1}-2.txt"], :rev => r1
432 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param],
433 :rev => r1
422 assert_response :success
434 assert_response :success
423 assert_template 'annotate'
435 assert_template 'annotate'
424 assert_tag :tag => 'th',
436 assert_tag :tag => 'th',
@@ -452,7 +464,8 class RepositoriesMercurialControllerTest < ActionController::TestCase
452 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
464 with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
453 [27, '7bbf4c738e71'].each do |r1|
465 [27, '7bbf4c738e71'].each do |r1|
454 get :annotate, :id => PRJ_ID,
466 get :annotate, :id => PRJ_ID,
455 :path => ['latin-1-dir', "test-#{@char_1}.txt"], :rev => r1
467 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
468 :rev => r1
456 assert_tag :tag => 'th',
469 assert_tag :tag => 'th',
457 :content => '1',
470 :content => '1',
458 :attributes => { :class => 'line-num' },
471 :attributes => { :class => 'line-num' },
General Comments 0
You need to be logged in to leave comments. Login now