Project

General

Profile

Defect #33085 » add_test.patch

Mizuki ISHIKAWA, 2020-03-09 06:40

View differences:

test/functional/enumerations_controller_test.rb
84 84
    assert_equal "sample", Enumeration.find_by(:name => 'Sample').custom_field_values.last.value
85 85
  end
86 86

  
87
  def test_create_with_multiple_select_list_custom_fields
88
    custom_field = IssuePriorityCustomField.generate!(:field_format => 'list', :multiple => true, :possible_values => ['1', '2', '3', '4'])
89
    assert_difference 'IssuePriority.count' do
90
      post :create, :params => {
91
          :enumeration => {
92
            :type => 'IssuePriority',
93
            :name => 'Sample',
94
            :custom_field_values => {custom_field.id.to_s => ['1', '2']}
95
          }
96
        }
97
    end
98
    assert_redirected_to '/enumerations'
99
    assert_equal ['1', '2'].sort, Enumeration.find_by(:name => 'Sample').custom_field_values.last.value.sort
100
  end
101

  
87 102
  def test_create_with_failure
88 103
    assert_no_difference 'IssuePriority.count' do
89 104
      post :create, :params => {
(2-2/2)