Project

General

Profile

Defect #5354 » 5354_fixed_v2.patch

Yuichi HARADA, 2020-02-12 04:03

View differences:

lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb
146 146
          end
147 147
          self.custom_values = target_custom_values
148 148
          custom_values.each(&:save)
149
          touch if !saved_changes? && custom_values.any?(&:saved_changes?)
149 150
          @custom_field_values_changed = false
150 151
          true
151 152
        end
test/functional/projects_controller_test.rb
994 994
    assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
995 995
  end
996 996

  
997
  def test_update_custom_field_should_update_updated_on
998
    @request.session[:user_id] = 2
999
    project = Project.find(1)
1000
    project.update_attribute :updated_on, nil
1001
    assert_equal 'Stable', project.custom_value_for(3).value
1002

  
1003
    travel_to Time.current do
1004
      post(
1005
        :update,
1006
        :params => {
1007
          :id => 1,
1008
          :project => {
1009
            :custom_field_values => {'3' => 'Alpha'}
1010
          }
1011
        }
1012
      )
1013
      assert_redirected_to '/projects/ecookbook/settings'
1014
      assert_equal 'Successful update.', flash[:notice]
1015
      project.reload
1016
      assert_equal 'Alpha', project.custom_value_for(3).value
1017
      assert_equal Time.current, project.updated_on
1018
    end
1019
  end
1020

  
997 1021
  def test_destroy_leaf_project_without_confirmation_should_show_confirmation
998 1022
    @request.session[:user_id] = 1 # admin
999 1023

  
(5-5/5)