1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 23:11:12 +00:00

IssuePriority.position_name not recalculated every time it should (#21504).

Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@14989 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-12-20 14:07:12 +00:00
parent 18b4925cee
commit ff7938cff2

View File

@ -99,6 +99,20 @@ class IssuePriorityTest < ActiveSupport::TestCase
assert_equal %w(lowest default high4 high3 high2 highest), IssuePriority.active.to_a.sort.map(&:position_name)
end
def test_moving_a_priority_should_update_position_names
prio = IssuePriority.first
prio.move_to = 'lowest'
prio.reload
assert_equal 'highest', prio.position_name
end
def test_deactivating_a_priority_should_update_position_names
prio = IssuePriority.active.order(:position).last
prio.active = false
prio.save
assert_equal 'highest', IssuePriority.active.order(:position).last.position_name
end
def test_destroying_a_priority_should_update_position_names
IssuePriority.find_by_position_name('highest').destroy
assert_equal %w(lowest default high2 highest), IssuePriority.active.to_a.sort.map(&:position_name)