summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-08-13 01:34:16 +0000
committerGo MAEDA <maeda@farend.jp>2024-08-13 01:34:16 +0000
commitcac20eef425071d85d18d424b0766fc83ac5b0dd (patch)
treeb72e9322fd811603274f333efc8ab8073ed87355 /test
parente7980d7f4c3574a12b3918910f6de837111afd4b (diff)
downloadredmine-cac20eef425071d85d18d424b0766fc83ac5b0dd.tar.gz
redmine-cac20eef425071d85d18d424b0766fc83ac5b0dd.zip
Merged r22947 and r22948 from trunk to 5.1-stable (#41079).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22957 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/query_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index c8ba72cad..bd975d71f 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -3291,4 +3291,19 @@ class QueryTest < ActiveSupport::TestCase
assert_equal 'board', query.display_type
end
+
+ def test_assigned_to_values_should_be_sorted_by_status_and_name
+ User.delete_all
+ 20.times do |i|
+ str = format('%03d', i)
+ status = i.even? ? User::STATUS_ACTIVE : User::STATUS_LOCKED
+ User.create!(firstname: str, lastname: str, login: str, mail: "#{str}@example.net", status: status)
+ end
+ query = IssueQuery.new(:name => '_')
+ query.stubs(:users).returns(User.all)
+
+ expected_names = User.order(:status, :firstname).all.map(&:name)
+ assigned_to_values = query.assigned_to_values
+ assert_equal expected_names, assigned_to_values[1..].map(&:first)
+ end
end