From 3495cba92bd8a2448381e01056920b48dd882180 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 20 Aug 2019 01:44:44 +0000 Subject: Per role visibility settings for project custom fields (#31925). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Jens Krämer and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18379 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/custom_fields_controller_test.rb | 20 ++++++++++++++++++++ test/functional/projects_controller_test.rb | 12 ++++++++++++ 2 files changed, 32 insertions(+) (limited to 'test') diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index e59d408ef..101a4c34f 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -126,6 +126,26 @@ class CustomFieldsControllerTest < Redmine::ControllerTest end end + def test_new_project_custom_field + get :new, :params => { + :type => 'ProjectCustomField' + } + assert_response :success + + assert_select 'form#custom_field_form' do + assert_select 'select#custom_field_field_format[name=?]', 'custom_field[field_format]' do + assert_select 'option[value=user]', :text => 'User' + assert_select 'option[value=version]', :text => 'Version' + end + + # Visibility + assert_select 'input[type=radio][name=?]', 'custom_field[visible]', 2 + assert_select 'input[type=checkbox][name=?]', 'custom_field[role_ids][]', 3 + + assert_select 'input[type=hidden][name=type][value=ProjectCustomField]' + end + end + def test_new_time_entry_custom_field_should_not_show_trackers_and_projects get :new, :params => { :type => 'TimeEntryCustomField' diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 389ad6c8a..63159ab90 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -726,6 +726,18 @@ class ProjectsControllerTest < Redmine::ControllerTest assert_select 'a#tab-activities' end + def test_settings_should_not_display_custom_fields_not_visible_for_user + @request.session[:user_id] = 2 + + ProjectCustomField.find_by_name('Development status').update_attribute :visible, false + get :settings, :params => { + :id => 'ecookbook' + } + assert_response :success + + assert_select 'select#project_custom_field_values_3', :count => 0 + end + def test_update @request.session[:user_id] = 2 # manager post :update, :params => { -- cgit v1.2.3