summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-08-20 01:44:44 +0000
committerGo MAEDA <maeda@farend.jp>2019-08-20 01:44:44 +0000
commit3495cba92bd8a2448381e01056920b48dd882180 (patch)
tree1abe416e54c45a5b33e5724b1fa356a8ce8378c0 /test
parenta1d454a1b18f503a30805a29b55fccecf97e48d7 (diff)
downloadredmine-3495cba92bd8a2448381e01056920b48dd882180.tar.gz
redmine-3495cba92bd8a2448381e01056920b48dd882180.zip
Per role visibility settings for project custom fields (#31925).
Patch by Jens Krämer and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18379 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/custom_fields_controller_test.rb20
-rw-r--r--test/functional/projects_controller_test.rb12
2 files changed, 32 insertions, 0 deletions
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 => {