From 9116b030a0bd65c8d65d795bfe97a491f5dd0e4c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 15 Sep 2018 06:47:03 +0000 Subject: Merged r17484 to 3.4-stable (#28925). git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17485 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/enumerations_controller_test.rb | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb index 1e0b75fb5..c1e52f67d 100644 --- a/test/functional/enumerations_controller_test.rb +++ b/test/functional/enumerations_controller_test.rb @@ -67,6 +67,21 @@ class EnumerationsControllerTest < Redmine::ControllerTest assert_not_nil e end + def test_create_with_custom_field_values + custom_field = CustomField.generate!(:type => "TimeEntryActivityCustomField") + assert_difference 'TimeEntryActivity.count' do + post :create, :params => { + :enumeration => { + :type => 'TimeEntryActivity', + :name => 'Sample', + :custom_field_values => {custom_field.id.to_s => "sample"} + } + } + end + assert_redirected_to '/enumerations' + assert_equal "sample", Enumeration.find_by(:name => 'Sample').custom_field_values.last.value + end + def test_create_with_failure assert_no_difference 'IssuePriority.count' do post :create, :params => { @@ -136,6 +151,20 @@ class EnumerationsControllerTest < Redmine::ControllerTest assert_equal 1, Enumeration.find(2).position end + def test_update_custom_field_values + custom_field = CustomField.generate!(:type => "TimeEntryActivityCustomField") + enumeration = Enumeration.find(9) + assert_nil enumeration.custom_field_values.last.value + put :update, :params => { + :id => enumeration.id, + :enumeration => { + :custom_field_values => {custom_field.id.to_s => "sample"} + } + } + assert_response 302 + assert_equal "sample", enumeration.reload.custom_field_values.last.value + end + def test_destroy_enumeration_not_in_use assert_difference 'IssuePriority.count', -1 do delete :destroy, :params => { -- cgit v1.2.3