summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-08-11 08:33:21 +0000
committerGo MAEDA <maeda@farend.jp>2024-08-11 08:33:21 +0000
commit0c28b0974adb3d9f777fbf0cc9234b1a7de144bf (patch)
tree6ada6cd1232bf2bd239ee082a9af2ba0fbe06300 /test
parent174c237c70527b7cb3a7ab8546ee6d238b791d74 (diff)
downloadredmine-0c28b0974adb3d9f777fbf0cc9234b1a7de144bf.tar.gz
redmine-0c28b0974adb3d9f777fbf0cc9234b1a7de144bf.zip
Add test for r22947 (#41079).
git-svn-id: https://svn.redmine.org/redmine/trunk@22948 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 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