5354_fixed.patch

Yuichi HARADA, 2020-01-20 06:59

Download (1.89 KB)

View differences:

lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb
145 145
            end
146 146
          end
147 147
          self.custom_values = target_custom_values
148
          custom_values_changed = custom_values.any?(&:changed?)
148 149
          custom_values.each(&:save)
150
          touch if persisted? && custom_values_changed
149 151
          @custom_field_values_changed = false
150 152
          true
151 153
        end
test/functional/projects_controller_test.rb
976 976
    assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort
977 977
  end
978 978

  
979
  def test_update_custom_field_should_update_updated_on
980
    @request.session[:user_id] = 2
981
    project = Project.find(1)
982
    project.update_attribute :updated_on, nil
983
    assert_equal 'Stable', project.custom_value_for(3).value
984

  
985
    travel_to Time.current do
986
      post(
987
        :update,
988
        :params => {
989
          :id => 1,
990
          :project => {
991
            :custom_field_values => {'3' => 'Alpha'}
992
          }
993
        }
994
      )
995
      assert_redirected_to '/projects/ecookbook/settings'
996
      assert_equal 'Successful update.', flash[:notice]
997
      project.reload
998
      assert_equal 'Alpha', project.custom_value_for(3).value
999
      assert_equal Time.current, project.updated_on
1000
    end
1001
  end
1002

  
979 1003
  def test_destroy_leaf_project_without_confirmation_should_show_confirmation
980 1004
    @request.session[:user_id] = 1 # admin
981 1005