diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-06-16 14:27:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-06-16 14:27:51 +0000 |
commit | 4137ba8e816c9e8c1782181e5bf1cb0d0ad09d75 (patch) | |
tree | d0e69f33679828abe1402d260a5c41938a9d44f8 | |
parent | 794a2a0180ed2d2801be4146ac59799747683b3d (diff) | |
download | redmine-4137ba8e816c9e8c1782181e5bf1cb0d0ad09d75.tar.gz redmine-4137ba8e816c9e8c1782181e5bf1cb0d0ad09d75.zip |
Removes repository routes without repository_id (#26522).
git-svn-id: http://svn.redmine.org/redmine/trunk@17386 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | config/routes.rb | 23 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 2 | ||||
-rw-r--r-- | test/functional/repositories_bazaar_controller_test.rb | 8 | ||||
-rw-r--r-- | test/functional/repositories_controller_test.rb | 20 | ||||
-rw-r--r-- | test/functional/repositories_cvs_controller_test.rb | 12 | ||||
-rw-r--r-- | test/functional/repositories_filesystem_controller_test.rb | 5 | ||||
-rw-r--r-- | test/functional/repositories_git_controller_test.rb | 34 | ||||
-rw-r--r-- | test/functional/repositories_mercurial_controller_test.rb | 24 | ||||
-rw-r--r-- | test/functional/repositories_subversion_controller_test.rb | 35 | ||||
-rw-r--r-- | test/helpers/application_helper_test.rb | 84 | ||||
-rw-r--r-- | test/integration/repositories_git_test.rb | 2 | ||||
-rw-r--r-- | test/integration/routing/repositories_test.rb | 39 | ||||
-rw-r--r-- | test/unit/mailer_test.rb | 6 |
14 files changed, 173 insertions, 125 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index b3886d536..235739057 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -129,9 +129,7 @@ class Repository < ActiveRecord::Base end def identifier_param - if is_default? - nil - elsif identifier.present? + if identifier.present? identifier else id.to_s diff --git a/config/routes.rb b/config/routes.rb index e5b25f904..8b8aa1311 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -253,21 +253,6 @@ Rails.application.routes.draw do :constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/} end - get 'projects/:id/repository/statistics', :to => 'repositories#stats' - get 'projects/:id/repository/graph', :to => 'repositories#graph' - - get 'projects/:id/repository/revisions', :to => 'repositories#revisions' - get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' - get 'projects/:id/repository/revision', :to => 'repositories#revision' - post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' - delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' - %w(browse show entry raw annotate diff).each do |action| - get "projects/:id/repository/revisions/:rev/#{action}(/*path)", - :controller => 'repositories', - :action => action, - :format => 'html', - :constraints => {:rev => /[a-z0-9\.\-_]+/, :path => /.*/} - end %w(browse entry raw changes annotate diff).each do |action| get "projects/:id/repository/:repository_id/#{action}(/*path)", :controller => 'repositories', @@ -275,16 +260,8 @@ Rails.application.routes.draw do :format => 'html', :constraints => {:path => /.*/} end - %w(browse entry raw changes annotate diff).each do |action| - get "projects/:id/repository/#{action}(/*path)", - :controller => 'repositories', - :action => action, - :format => 'html', - :constraints => {:path => /.*/} - end get 'projects/:id/repository/:repository_id/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/} - get 'projects/:id/repository/show/*path', :to => 'repositories#show', :format => 'html', :constraints => {:path => /.*/} get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil get 'projects/:id/repository', :to => 'repositories#show', :path => nil diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 9f79908eb..61b2ded0c 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2033,7 +2033,7 @@ class IssuesControllerTest < Redmine::ControllerTest :id => issue.id } - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/3' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/3' end def test_show_should_display_watchers diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb index ee9021abd..33b506444 100644 --- a/test/functional/repositories_bazaar_controller_test.rb +++ b/test/functional/repositories_bazaar_controller_test.rb @@ -68,6 +68,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_browse_directory get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['directory'])[:param] } assert_response :success @@ -82,6 +83,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_browse_at_given_revision get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash([])[:param], :rev => 3 } @@ -98,6 +100,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_changes get :changes, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['doc-mkdir.txt'])[:param] } assert_response :success @@ -107,6 +110,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_entry_show get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['directory', 'doc-ls.txt'])[:param] } assert_response :success @@ -117,6 +121,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_entry_download get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['directory', 'doc-ls.txt'])[:param], :format => 'raw' } @@ -128,6 +133,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_directory_entry get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['directory'])[:param] } assert_response :success @@ -139,6 +145,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 3, :type => dt } @@ -151,6 +158,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest def test_annotate get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['doc-mkdir.txt'])[:param] } assert_response :success diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb index e76a2f8c4..8338b8987 100644 --- a/test/functional/repositories_controller_test.rb +++ b/test/functional/repositories_controller_test.rb @@ -182,7 +182,8 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest def test_revisions get :revisions, :params => { - :id => 1 + :id => 1, + :repository_id => 10 } assert_response :success assert_select 'table.changesets' @@ -210,6 +211,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest def test_revision get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 1 } assert_response :success @@ -222,6 +224,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest with_settings :commit_logs_formatting => '0' do get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 1 } assert_response :success @@ -235,11 +238,12 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 1 } assert_response :success - assert_select 'form[action=?]', '/projects/ecookbook/repository/revisions/1/issues' do + assert_select 'form[action=?]', '/projects/ecookbook/repository/10/revisions/1/issues' do assert_select 'input[name=?]', 'issue_id' end end @@ -247,6 +251,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest def test_revision_should_not_change_the_project_menu_link get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 1 } assert_response :success @@ -257,13 +262,14 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest def test_revision_with_before_nil_and_afer_normal get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 1 } assert_response :success assert_select 'div.contextual' do - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/0', 0 - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/0', 0 + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/2' end end @@ -272,6 +278,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest assert_difference 'Changeset.find(103).issues.size' do post :add_related_issue, :params => { :id => 1, + :repository_id => 10, :rev => 4, :issue_id => 2, :format => 'js' @@ -290,6 +297,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest assert_difference 'Changeset.find(103).issues.size' do post :add_related_issue, :params => { :id => 1, + :repository_id => 10, :rev => 4, :issue_id => "#2", :format => 'js' @@ -304,6 +312,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest assert_no_difference 'Changeset.find(103).issues.size' do post :add_related_issue, :params => { :id => 1, + :repository_id => 10, :rev => 4, :issue_id => 9999, :format => 'js' @@ -323,6 +332,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest assert_difference 'Changeset.find(103).issues.size', -1 do delete :remove_related_issue, :params => { :id => 1, + :repository_id => 10, :rev => 4, :issue_id => 2, :format => 'js' @@ -343,6 +353,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest get :graph, :params => { :id => 1, + :repository_id => 10, :graph => 'commits_per_month' } assert_response :success @@ -356,6 +367,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest def test_graph_commits_per_author get :graph, :params => { :id => 1, + :repository_id => 10, :graph => 'commits_per_author' } assert_response :success diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb index c9f26719a..d2b12386d 100644 --- a/test/functional/repositories_cvs_controller_test.rb +++ b/test/functional/repositories_cvs_controller_test.rb @@ -86,6 +86,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param] } assert_response :success @@ -105,6 +106,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param], :rev => 1 } @@ -124,6 +126,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success @@ -139,6 +142,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :rev => 2 } @@ -155,7 +159,8 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, - :path => repository_path_hash(['sources', 'zzz.c'])[:param] + :repository_id => @repository.id, + :path => repository_path_hash(['sources', 'zzz.c'])[:param] } assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/ end @@ -167,6 +172,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :format => 'raw' } @@ -180,6 +186,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources'])[:param] } assert_response :success @@ -194,6 +201,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 3, :type => dt } @@ -212,6 +220,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 1, :type => dt } @@ -232,6 +241,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb index 1dd133c58..38e0f8ba9 100644 --- a/test/functional/repositories_filesystem_controller_test.rb +++ b/test/functional/repositories_filesystem_controller_test.rb @@ -79,6 +79,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest def test_show_no_extension get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['test'])[:param] } assert_response :success @@ -88,6 +89,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest def test_entry_download_no_extension get :raw, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['test'])[:param] } assert_response :success @@ -98,6 +100,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest with_settings :repositories_encodings => 'UTF-8,EUC-JP' do get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['japanese', 'euc-jp.txt'])[:param] } assert_response :success @@ -118,6 +121,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest with_settings :repositories_encodings => enc do get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['japanese', 'utf-16.txt'])[:param] } assert_response :success @@ -129,6 +133,7 @@ class RepositoriesFilesystemControllerTest < Redmine::RepositoryControllerTest with_settings :file_max_size_displayed => 1 do get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['japanese', 'big-file.txt'])[:param] } assert_response :success diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index f1261fa5c..5b9a02956 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -145,6 +145,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 'test_branch' } assert_response :success @@ -173,6 +174,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ].each do |t1| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => t1 } assert_response :success @@ -189,6 +191,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param] } assert_response :success @@ -207,6 +210,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param], :rev => '7234cb2750b63f47bff735edc50a1c0a433c2518' } @@ -221,6 +225,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_changes get :changes, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images', 'edit.png'])[:param] } assert_response :success @@ -230,6 +235,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_entry_show get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success @@ -249,6 +255,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1| get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param], :rev => r1 } @@ -262,6 +269,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_entry_download get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :format => 'raw' } @@ -273,6 +281,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_directory_entry get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources'])[:param] } assert_response :success @@ -293,6 +302,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', :type => dt } @@ -313,6 +323,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :type => dt @@ -337,6 +348,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest with_settings :default_language => 'en' do get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :type => 'inline', :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' } @@ -346,6 +358,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest with_settings :default_language => 'fr' do get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :type => 'inline', :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' } @@ -365,13 +378,14 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '61b685fbe55ab05b5ac68402d5720c1a6ac973d1', :rev_to => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', :type => dt } assert_response :success assert_select 'h2', :text => /2f9c0091:61b685fb/ - assert_select 'form[action=?]', '/projects/subproject1/repository/revisions/61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff' + assert_select 'form[action=?]', "/projects/subproject1/repository/#{@repository.id}/revisions/61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff" assert_select 'input#rev_to[type=hidden][name=rev_to][value=?]', '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' end end @@ -407,6 +421,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r1, :type => dt } @@ -424,6 +439,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_diff_should_show_filenames get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 'deff712f05a90d96edbd70facc47d944be5897e3', :type => 'inline' } @@ -444,6 +460,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest @request.session[:user_id] = 1 # admin get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' } assert_response :success @@ -451,6 +468,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest assert_equal "inline", user.pref[:diff_type] get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7', :type => 'sbs' } @@ -462,6 +480,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest def test_annotate get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success @@ -482,6 +501,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 'deff7', :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } @@ -493,6 +513,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest with_settings :default_language => 'en' do get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images', 'edit.png'])[:param] } assert_response :success @@ -504,6 +525,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest with_settings :file_max_size_displayed => 1 do get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :rev => 'deff712f' } @@ -512,6 +534,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['README'])[:param], :rev => '7234cb2' } @@ -531,6 +554,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['57ca437c', '57ca437c0acbbcb749821fdf3726a1367056d364'].each do |r1| get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{CHAR_1_HEX}.txt"])[:param], :rev => r1 } @@ -552,6 +576,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1| get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash([" filename with a leading space.txt "])[:param], :rev => r1 } @@ -573,9 +598,10 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest @project.reload assert_equal NUM_REV, @repository.changesets.count get :revisions, :params => { - :id => PRJ_ID + :id => PRJ_ID, + :repository_id => @repository.id } - assert_select 'form[method=get][action=?]', '/projects/subproject1/repository/revision' + assert_select 'form[method=get][action=?]', "/projects/subproject1/repository/#{@repository.id}/revision" end def test_revision @@ -586,6 +612,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['61b685fbe55ab05b5ac68402d5720c1a6ac973d1', '61b685f'].each do |r| get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r } assert_response :success @@ -600,6 +627,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest ['', ' ', nil].each do |r| get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r } assert_response 404 diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index d24b5bcbc..f7ba7038b 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -97,6 +97,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param] } assert_response :success @@ -120,6 +121,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [0, '0', '0885933ad4f6'].each do |r1| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images'])[:param], :rev => r1 } @@ -144,6 +146,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [13, '13', '3a330eb32958'].each do |r1| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sql_escape', 'percent%dir'])[:param], :rev => r1 } @@ -172,6 +175,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [21, '21', 'adf805632193'].each do |r1| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir'])[:param], :rev => r1 } @@ -223,6 +227,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ].each do |bra| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => bra } assert_response :success @@ -244,6 +249,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ].each do |tag| get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => tag } assert_response :success @@ -256,6 +262,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_changes get :changes, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['images', 'edit.png'])[:param] } assert_response :success @@ -265,6 +272,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_entry_show get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success @@ -276,6 +284,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [21, '21', 'adf805632193'].each do |r1| get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], :rev => r1 } @@ -289,6 +298,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [27, '27', '7bbf4c738e71'].each do |r1| get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param], :rev => r1 } @@ -301,6 +311,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_entry_download get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param], :format => 'raw' } @@ -316,6 +327,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_directory_entry get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources'])[:param] } assert_response :success @@ -333,6 +345,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r1, :type => dt } @@ -356,6 +369,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r1, :rev_to => r2, :type => dt @@ -373,6 +387,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r1, :type => dt } @@ -389,6 +404,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_diff_should_show_modified_filenames get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '400bb8672109', :type => 'inline' } @@ -399,6 +415,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_diff_should_show_deleted_filenames get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 'b3a615152df8', :type => 'inline' } @@ -409,6 +426,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest def test_annotate get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } assert_response :success @@ -429,6 +447,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['sources', 'welcome_controller.rb'])[:param] } assert_response 404 @@ -443,6 +462,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [2, '400bb8672109', '400', 400].each do |r1| get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r1, :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] } @@ -455,6 +475,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [21, '21', 'adf805632193'].each do |r1| get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}-2.txt"])[:param], :rev => r1 } @@ -476,6 +497,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest [27, '7bbf4c738e71'].each do |r1| get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param], :rev => r1 } @@ -493,6 +515,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest with_settings :default_language => "en" do get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r } assert_response :success @@ -510,6 +533,7 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest ['', ' ', nil].each do |r| get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r } assert_response 404 diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index f8f4b8f9d..e9de476a4 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -65,7 +65,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_select 'table.entries tbody' do assert_select 'tr', 1 assert_select 'tr.dir td.filename a', :text => 'subversion_test' - assert_select 'tr.dir td.filename a[href=?]', '/projects/subproject1/repository/show/subversion_test' + assert_select 'tr.dir td.filename a[href=?]', "/projects/subproject1/repository/#{@repository.id}/show/subversion_test" end assert_select 'table.changesets tbody' do @@ -76,7 +76,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_select 'input[name=rev]' assert_select 'a', :text => 'Statistics' assert_select 'a', :text => 'Atom' - assert_select 'a[href=?]', '/projects/subproject1/repository', :text => 'root' + assert_select 'a[href=?]', "/projects/subproject1/repository/#{@repository.id}", :text => 'root' end def test_show_non_default @@ -102,6 +102,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test'])[:param] } assert_response :success @@ -125,6 +126,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :show, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test'])[:param], :rev => 4 } @@ -147,6 +149,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :changes, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder', 'helloworld.rb'])[:param] } assert_response :success @@ -174,6 +177,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :changes, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder'])[:param] } assert_response :success @@ -196,6 +200,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } assert_response :success @@ -212,6 +217,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest with_settings :file_max_size_displayed => 0 do get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } assert_response :success @@ -223,10 +229,11 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest def test_entry_should_display_images get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder', 'subfolder', 'rubylogo.gif'])[:param] } assert_response :success - assert_select 'img[src=?]', '/projects/subproject1/repository/raw/subversion_test/folder/subfolder/rubylogo.gif' + assert_select 'img[src=?]', "/projects/subproject1/repository/#{@repository.id}/raw/subversion_test/folder/subfolder/rubylogo.gif" end def test_entry_at_given_revision @@ -236,6 +243,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.rb'])[:param], :rev => 2 } @@ -251,6 +259,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'zzz.c'])[:param] } assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/ @@ -263,6 +272,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :raw, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } assert_response :success @@ -276,6 +286,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :entry, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'folder'])[:param] } assert_response :success @@ -287,6 +298,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest def test_revision get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 2 } assert_response :success @@ -294,9 +306,9 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_select 'ul' do assert_select 'li' do # link to the entry at rev 2 - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo', :text => 'repo' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/2/entry/test/some/path/in/the/repo', :text => 'repo' # link to partial diff - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/2/diff/test/some/path/in/the/repo' end end end @@ -308,6 +320,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 'something_weird' } assert_response 404 @@ -317,6 +330,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest def test_invalid_revision_diff get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => '1', :rev_to => 'something_weird' } @@ -332,6 +346,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest ['', ' ', nil].each do |r| get :revision, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => r } assert_response 404 @@ -347,6 +362,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest get :revision, :params => { :id => 1, + :repository_id => 10, :rev => 2 } assert_response :success @@ -354,9 +370,9 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_select 'ul' do assert_select 'li' do # link to the entry at rev 2 - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo', :text => 'repo' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/2/entry/path/in/the/repo', :text => 'repo' # link to partial diff - assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' + assert_select 'a[href=?]', '/projects/ecookbook/repository/10/revisions/2/diff/path/in/the/repo' end end end @@ -369,6 +385,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 3, :type => dt } @@ -386,6 +403,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 5, :format => 'diff' } @@ -402,6 +420,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest ['inline', 'sbs'].each do |dt| get :diff, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 6, :rev_to => 2, :path => repository_path_hash(['subversion_test', 'folder'])[:param], @@ -424,6 +443,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } assert_response :success @@ -449,6 +469,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest assert_equal NUM_REV, @repository.changesets.count get :annotate, :params => { :id => PRJ_ID, + :repository_id => @repository.id, :rev => 8, :path => repository_path_hash(['subversion_test', 'helloworld.c'])[:param] } diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 1269521d0..bd8debcea 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -289,13 +289,13 @@ RAW note_link2 = link_to('#3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, :class => Issue.find(3).css_classes, :title => 'Bug: Error 281 when updating a recipe (New)') - revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, + revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 1}, :class => 'changeset', :title => 'My very first commit do not escaping #<>&') - revision_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, + revision_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') changeset_link2 = link_to('691322a8eb01e11fd7', - {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, + {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 1}, :class => 'changeset', :title => 'My very first commit do not escaping #<>&') document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1}, @@ -312,17 +312,17 @@ RAW project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'} - source_url = '/projects/ecookbook/repository/entry/some/file' - source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file' - source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext' - source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext' - source_url_with_branch = '/projects/ecookbook/repository/revisions/branch/entry/some/file' + source_url = '/projects/ecookbook/repository/10/entry/some/file' + source_url_with_rev = '/projects/ecookbook/repository/10/revisions/52/entry/some/file' + source_url_with_ext = '/projects/ecookbook/repository/10/entry/some/file.ext' + source_url_with_rev_and_ext = '/projects/ecookbook/repository/10/revisions/52/entry/some/file.ext' + source_url_with_branch = '/projects/ecookbook/repository/10/revisions/branch/entry/some/file' - export_url = '/projects/ecookbook/repository/raw/some/file' - export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file' - export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext' - export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext' - export_url_with_branch = '/projects/ecookbook/repository/revisions/branch/raw/some/file' + export_url = '/projects/ecookbook/repository/10/raw/some/file' + export_url_with_rev = '/projects/ecookbook/repository/10/revisions/52/raw/some/file' + export_url_with_ext = '/projects/ecookbook/repository/10/raw/some/file.ext' + export_url_with_rev_and_ext = '/projects/ecookbook/repository/10/revisions/52/raw/some/file.ext' + export_url_with_branch = '/projects/ecookbook/repository/10/revisions/branch/raw/some/file' to_test = { # tickets @@ -439,11 +439,11 @@ RAW def test_cross_project_redmine_links source_link = link_to('ecookbook:source:/some/file', {:controller => 'repositories', :action => 'entry', - :id => 'ecookbook', :path => ['some', 'file']}, + :id => 'ecookbook', :repository_id => 10, :path => ['some', 'file']}, :class => 'source') changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', - :id => 'ecookbook', :rev => 2}, + :id => 'ecookbook', :repository_id => 10, :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') to_test = { @@ -521,14 +521,14 @@ RAW hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg') Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd') - changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, + changeset_link = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') svn_changeset_link = link_to('svn_repo-1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn_repo-1', :rev => 123}, :class => 'changeset', :title => '') hg_changeset_link = link_to('hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, :class => 'changeset', :title => '') - source_link = link_to('source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, :class => 'source') + source_link = link_to('source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 10, :path => ['some', 'file']}, :class => 'source') hg_source_link = link_to('source:hg1|some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 'hg1', :path => ['some', 'file']}, :class => 'source') to_test = { @@ -553,14 +553,14 @@ RAW hg = Repository::Mercurial.create!(:project_id => 1, :identifier => 'hg1', :url => '/foo/hg') Changeset.create!(:repository => hg, :committed_on => Time.now, :revision => '123', :scmid => 'abcd') - changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, + changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 10, :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') svn_changeset_link = link_to('ecookbook:svn1|r123', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'svn1', :rev => 123}, :class => 'changeset', :title => '') hg_changeset_link = link_to('ecookbook:hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, :class => 'changeset', :title => '') - source_link = link_to('ecookbook:source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, :class => 'source') + source_link = link_to('ecookbook:source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 10, :path => ['some', 'file']}, :class => 'source') hg_source_link = link_to('ecookbook:source:hg1|some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 'hg1', :path => ['some', 'file']}, :class => 'source') to_test = { @@ -582,60 +582,62 @@ RAW end def test_redmine_links_git_commit + @project = Project.find(3) + r = Repository::Git.create!(:project => @project, :url => '/tmp/test/git') + + c = Changeset.create!(:repository => r, + :committed_on => Time.now, + :revision => 'abcd', + :scmid => 'abcd', + :comments => 'test commit') + changeset_link = link_to('abcd', { :controller => 'repositories', :action => 'revision', :id => 'subproject1', + :repository_id => r.id, :rev => 'abcd', }, :class => 'changeset', :title => 'test commit') to_test = { 'commit:abcd' => changeset_link, } - @project = Project.find(3) - r = Repository::Git.create!(:project => @project, :url => '/tmp/test/git') - assert r - c = Changeset.new(:repository => r, - :committed_on => Time.now, - :revision => 'abcd', - :scmid => 'abcd', - :comments => 'test commit') - assert( c.save ) to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } end # TODO: Bazaar commit id contains mail address, so it contains '@' and '_'. def test_redmine_links_mercurial_commit + @project = Project.find(3) + r = Repository::Mercurial.create!(:project => @project, :url => '/tmp/test') + c = Changeset.create!(:repository => r, + :committed_on => Time.now, + :revision => '123', + :scmid => 'abcd', + :comments => 'test commit') + changeset_link_rev = link_to('r123', { :controller => 'repositories', :action => 'revision', :id => 'subproject1', + :repository_id => r.id, :rev => '123' , }, :class => 'changeset', :title => 'test commit') changeset_link_commit = link_to('abcd', { - :controller => 'repositories', - :action => 'revision', - :id => 'subproject1', - :rev => 'abcd' , + :controller => 'repositories', + :action => 'revision', + :id => 'subproject1', + :repository_id => r.id, + :rev => 'abcd' , }, :class => 'changeset', :title => 'test commit') to_test = { 'r123' => changeset_link_rev, 'commit:abcd' => changeset_link_commit, } - @project = Project.find(3) - r = Repository::Mercurial.create!(:project => @project, :url => '/tmp/test') - assert r - c = Changeset.new(:repository => r, - :committed_on => Time.now, - :revision => '123', - :scmid => 'abcd', - :comments => 'test commit') - assert( c.save ) to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } end diff --git a/test/integration/repositories_git_test.rb b/test/integration/repositories_git_test.rb index 049b339bb..ba1922240 100644 --- a/test/integration/repositories_git_test.rb +++ b/test/integration/repositories_git_test.rb @@ -43,7 +43,7 @@ class RepositoriesGitTest < Redmine::IntegrationTest end def test_diff_two_revs - get '/projects/subproject1/repository/diff?rev=61b685fbe&rev_to=2f9c0091' + get "/projects/subproject1/repository/#{@repository.id}/diff?rev=61b685fbe&rev_to=2f9c0091" assert_response :success end end diff --git a/test/integration/routing/repositories_test.rb b/test/integration/routing/repositories_test.rb index 337686169..15f707091 100644 --- a/test/integration/routing/repositories_test.rb +++ b/test/integration/routing/repositories_test.rb @@ -20,7 +20,7 @@ require File.expand_path('../../../test_helper', __FILE__) class RoutingRepositoriesTest < Redmine::RoutingTest def setup - @paths = ['path/to/file.c', 'path/to/index.html'] + @paths = ['path/to/file.c', 'path/to/index.html', 'raw/file.c'] end def test_repositories_resources @@ -37,8 +37,6 @@ class RoutingRepositoriesTest < Redmine::RoutingTest def test_repositories should_route 'GET /projects/foo/repository' => 'repositories#show', :id => 'foo' - should_route 'GET /projects/foo/repository/statistics' => 'repositories#stats', :id => 'foo' - should_route 'GET /projects/foo/repository/graph' => 'repositories#graph', :id => 'foo' end def test_repositories_with_repository_id @@ -47,23 +45,6 @@ class RoutingRepositoriesTest < Redmine::RoutingTest should_route 'GET /projects/foo/repository/svn/graph' => 'repositories#graph', :id => 'foo', :repository_id => 'svn' end - def test_repositories_revisions - should_route 'GET /projects/foo/repository/revision' => 'repositories#revision', :id => 'foo' - should_route 'GET /projects/foo/repository/revisions' => 'repositories#revisions', :id => 'foo' - should_route 'GET /projects/foo/repository/revisions.atom' => 'repositories#revisions', :id => 'foo', :format => 'atom' - - should_route 'GET /projects/foo/repository/revisions/2457' => 'repositories#revision', :id => 'foo', :rev => '2457' - should_route 'GET /projects/foo/repository/revisions/2457/show' => 'repositories#show', :id => 'foo', :rev => '2457', :format => 'html' - should_route 'GET /projects/foo/repository/revisions/2457/diff' => 'repositories#diff', :id => 'foo', :rev => '2457', :format => 'html' - - %w(show diff entry raw annotate).each do |action| - @paths.each do |path| - should_route "GET /projects/foo/repository/revisions/2457/#{action}/#{path}" => "repositories##{action}", - :id => 'foo', :rev => '2457', :path => path, :format => 'html' - end - end - end - def test_repositories_revisions_with_repository_id should_route 'GET /projects/foo/repository/foo/revision' => 'repositories#revision', :id => 'foo', :repository_id => 'foo' should_route 'GET /projects/foo/repository/foo/revisions' => 'repositories#revisions', :id => 'foo', :repository_id => 'foo' @@ -81,17 +62,6 @@ class RoutingRepositoriesTest < Redmine::RoutingTest end end - def test_repositories_non_revisions_path - should_route 'GET /projects/foo/repository/changes' => 'repositories#changes', :id => 'foo', :format => 'html' - - %w(changes diff browse entry raw annotate).each do |action| - @paths.each do |path| - should_route "GET /projects/foo/repository/#{action}/#{path}" => "repositories##{action}", - :id => 'foo', :path => path, :format => 'html' - end - end - end - def test_repositories_non_revisions_path_with_repository_id should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn', :format => 'html' @@ -103,13 +73,6 @@ class RoutingRepositoriesTest < Redmine::RoutingTest end end - def test_repositories_related_issues - should_route 'POST /projects/foo/repository/revisions/123/issues' => 'repositories#add_related_issue', - :id => 'foo', :rev => '123' - should_route 'DELETE /projects/foo/repository/revisions/123/issues/25' => 'repositories#remove_related_issue', - :id => 'foo', :rev => '123', :issue_id => '25' - end - def test_repositories_related_issues_with_repository_id should_route 'POST /projects/foo/repository/svn/revisions/123/issues' => 'repositories#add_related_issue', :id => 'foo', :repository_id => 'svn', :rev => '123' diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 36f028d89..049db8198 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -62,7 +62,7 @@ class MailerTest < ActiveSupport::TestCase :text => '#1' # link to a changeset assert_select 'a[href=?][title=?]', - 'https://mydomain.foo/projects/ecookbook/repository/revisions/2', + 'https://mydomain.foo/projects/ecookbook/repository/10/revisions/2', 'This commit fixes #1, #2 and references #1 & #3', :text => 'r2' # link to a description diff @@ -102,7 +102,7 @@ class MailerTest < ActiveSupport::TestCase :text => '#1' # link to a changeset assert_select 'a[href=?][title=?]', - 'http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2', + 'http://mydomain.foo/rdm/projects/ecookbook/repository/10/revisions/2', 'This commit fixes #1, #2 and references #1 & #3', :text => 'r2' # link to a description diff @@ -172,7 +172,7 @@ class MailerTest < ActiveSupport::TestCase :text => '#1' # link to a changeset assert_select 'a[href=?][title=?]', - 'http://mydomain.foo/rdm/projects/ecookbook/repository/revisions/2', + 'http://mydomain.foo/rdm/projects/ecookbook/repository/10/revisions/2', 'This commit fixes #1, #2 and references #1 & #3', :text => 'r2' # link to a description diff |