summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_priority_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-17 06:57:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-17 06:57:20 +0000
commit64afa24a7f72526a2cbf6761e51b6cd326aa0c36 (patch)
treee0766ba52e537838fb6c06c09e81b10010690b09 /test/unit/issue_priority_test.rb
parentf2eb979f66da758fbed7d98ae970f7ef74d1263f (diff)
downloadredmine-64afa24a7f72526a2cbf6761e51b6cd326aa0c36.tar.gz
redmine-64afa24a7f72526a2cbf6761e51b6cd326aa0c36.zip
Replaces acts_as_list with an implementation that handles #position= (#12909).
Objects are reordered using the regular attribute writer #position= and AR callbacks. git-svn-id: http://svn.redmine.org/redmine/trunk@15335 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_priority_test.rb')
-rw-r--r--test/unit/issue_priority_test.rb20
1 files changed, 1 insertions, 19 deletions
diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb
index b4aa0852b..bc4202d74 100644
--- a/test/unit/issue_priority_test.rb
+++ b/test/unit/issue_priority_test.rb
@@ -55,25 +55,6 @@ class IssuePriorityTest < ActiveSupport::TestCase
assert_equal [1, 2, 3], priorities.map(&:position)
end
- def test_reset_positions_in_list_should_set_sequential_positions
- IssuePriority.delete_all
-
- priorities = [1, 2, 3].map {|i| IssuePriority.create!(:name => "P#{i}")}
- priorities[0].update_attribute :position, 4
- priorities[1].update_attribute :position, 2
- priorities[2].update_attribute :position, 7
- assert_equal [4, 2, 7], priorities.map(&:reload).map(&:position)
-
- priorities[0].reset_positions_in_list
- assert_equal [2, 1, 3], priorities.map(&:reload).map(&:position)
- end
-
- def test_moving_in_list_should_reset_positions
- priority = IssuePriority.first
- priority.expects(:reset_positions_in_list).once
- priority.move_to = 'higher'
- end
-
def test_clear_position_names_should_set_position_names_to_nil
IssuePriority.clear_position_names
assert IssuePriority.all.all? {|priority| priority.position_name.nil?}
@@ -102,6 +83,7 @@ class IssuePriorityTest < ActiveSupport::TestCase
def test_moving_a_priority_should_update_position_names
prio = IssuePriority.first
prio.move_to = 'lowest'
+ prio.save!
prio.reload
assert_equal 'highest', prio.position_name
end