summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-07-31 13:09:09 +0000
committerGo MAEDA <maeda@farend.jp>2022-07-31 13:09:09 +0000
commit117553bb4902a1123a94214e9021884cfbf4e555 (patch)
tree983f3bd790f14327891c34539d99c29bf141a33c /test
parentcbd2e83b01bc544648b0269368bd640ecc3ff42e (diff)
downloadredmine-117553bb4902a1123a94214e9021884cfbf4e555.tar.gz
redmine-117553bb4902a1123a94214e9021884cfbf4e555.zip
Merged r21741 and r21742 from trunk to 5.0-stable (#33953).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21747 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/repositories_controller_test.rb22
-rw-r--r--test/integration/lib/redmine/menu_manager_test.rb31
2 files changed, 52 insertions, 1 deletions
diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb
index 2765dd1a1..9ba464e67 100644
--- a/test/functional/repositories_controller_test.rb
+++ b/test/functional/repositories_controller_test.rb
@@ -188,6 +188,28 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
end
end
+ def test_show_without_main_repository_should_display_first_repository
+ skip unless repository_configured?('subversion')
+
+ project = Project.find(1)
+ repos = project.repositories
+ repos << Repository::Subversion.create(:identifier => 'test', :url => 'svn://valid')
+ assert_equal true, repos.exists?(:is_default => true)
+
+ repos.update_all(:is_default => false)
+ repos.reload
+ assert_equal false, repos.exists?(:is_default => true)
+
+ repository = repos.first
+ @request.session[:user_id] = 2
+
+ get(:show, :params => {:id => 1})
+ assert_response :success
+ assert_select '#sidebar' do
+ assert_select 'a.repository.selected[href=?]', "/projects/#{project.identifier}/repository/#{repository.identifier_param}"
+ end
+ end
+
def test_show_should_show_diff_button_depending_on_browse_repository_permission
skip unless repository_configured?('subversion')
diff --git a/test/integration/lib/redmine/menu_manager_test.rb b/test/integration/lib/redmine/menu_manager_test.rb
index 1f5a2b8b4..c21d93c9f 100644
--- a/test/integration/lib/redmine/menu_manager_test.rb
+++ b/test/integration/lib/redmine/menu_manager_test.rb
@@ -28,7 +28,8 @@ class MenuManagerTest < Redmine::IntegrationTest
:roles,
:member_roles,
:members,
- :enabled_modules
+ :enabled_modules,
+ :repositories
def test_project_menu_with_specific_locale
get '/projects/ecookbook/issues',
@@ -80,6 +81,34 @@ class MenuManagerTest < Redmine::IntegrationTest
end
end
+ def test_project_menu_should_display_repository_tab_when_exists_repository
+ project = Project.find('ecookbook')
+ repos = project.repositories
+ assert_equal true, repos.exists?
+
+ log_user('jsmith', 'jsmith')
+
+ assert_equal true, repos.exists?(:is_default => true)
+ get '/projects/ecookbook'
+ assert_select '#main-menu' do
+ assert_select 'a.repository', :count => 1
+ end
+
+ repos.update_all(:is_default => false)
+ assert_equal false, repos.exists?(:is_default => true)
+ get '/projects/ecookbook'
+ assert_select '#main-menu' do
+ assert_select 'a.repository', :count => 1
+ end
+
+ repos.delete_all
+ assert_equal false, repos.exists?
+ get '/projects/ecookbook'
+ assert_select '#main-menu' do
+ assert_select 'a.repository', :count => 0
+ end
+ end
+
def test_main_menu_should_select_projects_tab_on_project_list
get '/projects'
assert_select '#main-menu' do