summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/acts/positioned.rb16
-rw-r--r--test/functional/roles_controller_test.rb8
-rw-r--r--test/unit/enumeration_test.rb2
-rw-r--r--test/unit/issue_priority_test.rb2
4 files changed, 6 insertions, 22 deletions
diff --git a/lib/redmine/acts/positioned.rb b/lib/redmine/acts/positioned.rb
index a322f1346..75041fe38 100644
--- a/lib/redmine/acts/positioned.rb
+++ b/lib/redmine/acts/positioned.rb
@@ -47,22 +47,6 @@ module Redmine
base.extend ClassMethods
end
- # Move to the given position
- # For compatibility with the previous way of sorting items
- def move_to=(pos)
- case pos.to_s
- when 'highest'
- self.position = 1
- when 'higher'
- self.position -= 1 if position > 1
- when 'lower'
- self.position += 1
- when 'lowest'
- self.position = nil
- set_default_position
- end
- end
-
private
def position_scope
diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb
index d86943966..8ce469395 100644
--- a/test/functional/roles_controller_test.rb
+++ b/test/functional/roles_controller_test.rb
@@ -181,27 +181,27 @@ class RolesControllerTest < ActionController::TestCase
end
def test_move_highest
- put :update, :id => 3, :role => {:move_to => 'highest'}
+ put :update, :id => 3, :role => {:position => 1}
assert_redirected_to '/roles'
assert_equal 1, Role.find(3).position
end
def test_move_higher
position = Role.find(3).position
- put :update, :id => 3, :role => {:move_to => 'higher'}
+ put :update, :id => 3, :role => {:position => position - 1}
assert_redirected_to '/roles'
assert_equal position - 1, Role.find(3).position
end
def test_move_lower
position = Role.find(2).position
- put :update, :id => 2, :role => {:move_to => 'lower'}
+ put :update, :id => 2, :role => {:position => position + 1}
assert_redirected_to '/roles'
assert_equal position + 1, Role.find(2).position
end
def test_move_lowest
- put :update, :id => 2, :role => {:move_to => 'lowest'}
+ put :update, :id => 2, :role => {:position => Role.givable.count}
assert_redirected_to '/roles'
assert_equal Role.givable.count, Role.find(2).position
end
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb
index ba64440de..2e7fa842e 100644
--- a/test/unit/enumeration_test.rb
+++ b/test/unit/enumeration_test.rb
@@ -154,7 +154,7 @@ class EnumerationTest < ActiveSupport::TestCase
a = IssuePriority.create!(:name => 'A')
b = IssuePriority.create!(:name => 'B')
override = IssuePriority.create!(:name => 'BB', :parent_id => b.id)
- b.move_to = 'higher'
+ b.position -= 1
b.save!
assert_equal [2, 1, 1], [a, b, override].map(&:reload).map(&:position)
diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb
index bc4202d74..9435a4757 100644
--- a/test/unit/issue_priority_test.rb
+++ b/test/unit/issue_priority_test.rb
@@ -82,7 +82,7 @@ class IssuePriorityTest < ActiveSupport::TestCase
def test_moving_a_priority_should_update_position_names
prio = IssuePriority.first
- prio.move_to = 'lowest'
+ prio.position = IssuePriority.count
prio.save!
prio.reload
assert_equal 'highest', prio.position_name