summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 06:45:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 06:45:10 +0000
commit9d00ca96a1fa33df8d89b50c845d44d7ce3f2a02 (patch)
tree894bda9d9eab45df4807e59da4054e2875364655 /test/functional
parent5660b06f7bd3ed48bbfaed2e0a98281b4da463c2 (diff)
downloadredmine-9d00ca96a1fa33df8d89b50c845d44d7ce3f2a02.tar.gz
redmine-9d00ca96a1fa33df8d89b50c845d44d7ce3f2a02.zip
Custom field values for enumerations not saved (#28925).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@17484 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/enumerations_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
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 => {