Rails3: test: scm: subversion: use "repository_path_hash" for path param

Rails3 new route format returns path param as string not array.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8930 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-02-23 10:10:48 +00:00
parent cc79bc6ffe
commit 5033a155b3
1 changed files with 28 additions and 14 deletions

View File

@ -73,7 +73,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :show, :id => PRJ_ID, :path => ['subversion_test'] get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param]
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
@ -93,7 +93,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4 get :show, :id => PRJ_ID, :path => repository_path_hash(['subversion_test'])[:param],
:rev => 4
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
assert_not_nil assigns(:entries) assert_not_nil assigns(:entries)
@ -106,7 +107,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ] get :changes, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param]
assert_response :success assert_response :success
assert_template 'changes' assert_template 'changes'
@ -130,7 +132,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ] get :changes, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
assert_response :success assert_response :success
assert_template 'changes' assert_template 'changes'
@ -144,7 +147,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'] get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
assert_response :success assert_response :success
assert_template 'entry' assert_template 'entry'
end end
@ -156,7 +160,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
# no files in the test repo is larger than 1KB... # no files in the test repo is larger than 1KB...
with_settings :file_max_size_displayed => 0 do with_settings :file_max_size_displayed => 0 do
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'] get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
assert_response :success assert_response :success
assert_template '' assert_template ''
assert_equal 'attachment; filename="helloworld.c"', assert_equal 'attachment; filename="helloworld.c"',
@ -169,7 +174,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2 get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param],
:rev => 2
assert_response :success assert_response :success
assert_template 'entry' assert_template 'entry'
# this line was removed in r3 and file was moved in r6 # this line was removed in r3 and file was moved in r6
@ -182,9 +189,10 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c'] get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'zzz.c'])[:param]
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/ :content => /The entry or revision was not found in the repository/
end end
def test_entry_download def test_entry_download
@ -192,7 +200,9 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw' get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param],
:format => 'raw'
assert_response :success assert_response :success
assert_template '' assert_template ''
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition'] assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
@ -203,7 +213,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder'] get :entry, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'folder'])[:param]
assert_response :success assert_response :success
assert_template 'show' assert_template 'show'
assert_not_nil assigns(:entry) assert_not_nil assigns(:entry)
@ -313,7 +324,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
['inline', 'sbs'].each do |dt| ['inline', 'sbs'].each do |dt|
get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2, get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2,
:path => ['subversion_test', 'folder'], :type => dt :path => repository_path_hash(['subversion_test', 'folder'])[:param],
:type => dt
assert_response :success assert_response :success
assert_template 'diff' assert_template 'diff'
@ -330,7 +342,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'] get :annotate, :id => PRJ_ID,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
assert_response :success assert_response :success
assert_template 'annotate' assert_template 'annotate'
end end
@ -340,7 +353,8 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c'] get :annotate, :id => PRJ_ID, :rev => 8,
:path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param]
assert_response :success assert_response :success
assert_template 'annotate' assert_template 'annotate'
assert_tag :tag => 'h2', :content => /@ 8/ assert_tag :tag => 'h2', :content => /@ 8/