From 0c28b0974adb3d9f777fbf0cc9234b1a7de144bf Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 11 Aug 2024 08:33:21 +0000 Subject: Add test for r22947 (#41079). git-svn-id: https://svn.redmine.org/redmine/trunk@22948 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/query_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index efc59d690..d26743cad 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -3344,4 +3344,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 -- cgit v1.2.3