summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 06:47:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 06:47:03 +0000
commit9116b030a0bd65c8d65d795bfe97a491f5dd0e4c (patch)
tree0781eac554d3718a4bd3b78d5a75d633f1e3be2d /test
parentaa82fdd95ef7adaddc2d37c71857868d6e1d3e21 (diff)
downloadredmine-9116b030a0bd65c8d65d795bfe97a491f5dd0e4c.tar.gz
redmine-9116b030a0bd65c8d65d795bfe97a491f5dd0e4c.zip
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
Diffstat (limited to 'test')
-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 => {