Actions
Patch #41894
closedFix random test failure by ensuring WatchersController#find_objects_from_params returns results in consistent order
Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
Description
WatchersController#find_objects_from_params
does not explicitly order its results. This leads to inconsistent ordering in WatchersController#find_watchables
, causing random failures in WatchersControllerTest#test_new_with_multiple_objects_from_different_projects
.
The attached patch resolves this issue by ensuring results are consistently ordered by ID.
Failure: WatchersControllerTest#test_new_with_multiple_objects_from_different_projects [test/functional/watchers_controller_test.rb:208]: Expected /\/watchers\/autocomplete_for_user\?object_id%5B%5D=7&object_id%5B%5D=9&object_type=issue/ to match "$('#ajax-modal').html(\n '<h3 class=\\\"title\\\">Add watchers<\\/h3>\\n\\n<form id=\\\"new-watcher-form\\\" action=\\\"/watchers\\\" accept-charset=\\\"UTF-8\\\" data-remote=\\\"true\\\" name=\\\"new-watcher-form-c11f8550\\\" method=\\\"post\\\">\\n\\n <input type=\\\"hidden\\\" name=\\\"object_type\\\" id=\\\"object_type\\\" value=\\\"issue\\\" autocomplete=\\\"off\\\" />\\n <input type=\\\"hidden\\\" name=\\\"object_id[]\\\" id=\\\"object_id_\\\" value=\\\"9\\\" autocomplete=\\\"off\\\" />\\n <input type=\\\"hidden\\\" name=\\\"object_id[]\\\" id=\\\"object_id_\\\" value=\\\"7\\\" autocomplete=\\\"off\\\" />\\n \\n\\n <p><label for=\\\"user_search\\\">Search for user:<\\/label><input type=\\\"text\\\" name=\\\"user_search\\\" id=\\\"user_search\\\" /><\\/p>\\n <script>\\n//<![CDATA[\\nobserveSearchfield(\\n \\'user_search\\',\\n \\'users_for_watcher\\',\\n \\'/watchers/autocomplete_for_user?object_id%5B%5D=9&object_id%5B%5D=7&object_type=issue\\'\\n )\\n//]]>\\n<\\/script>\\n <div id=\\\"users_for_watcher\\\">\\n <label><input type=\\\"checkbox\\\" name=\\\"watcher[user_ids][]\\\" value=\\\"2\\\" /><span class=\\\"name icon icon-user\\\"><\\/span>John Smith<\\/label><label><input type=\\\"checkbox\\\" name=\\\"watcher[user_ids][]\\\" value=\\\"1\\\" /><span class=\\\"name icon icon-user\\\"><\\/span>Redmine Admin<\\/label><label><input type=\\\"checkbox\\\" name=\\\"watcher[user_ids][]\\\" value=\\\"8\\\" /><span class=\\\"name icon icon-user\\\"><\\/span>User Misc<\\/label><label><input type=\\\"checkbox\\\" name=\\\"watcher[user_ids][]\\\" value=\\\"10\\\" /><span class=\\\"name icon icon-group\\\"><svg class=\\\"s18 icon-svg\\\" aria-hidden=\\\"true\\\"><use href=\\\"/assets/icons-903cd898.svg#icon--group\\\"><\\/use><\\/svg><\\/span>A Team<\\/label>\\n <\\/div>\\n\\n <p class=\\\"buttons\\\">\\n <input type=\\\"submit\\\" value=\\\"Add\\\" onclick=\\\"hideModal(this);\\\" data-disable-with=\\\"Add\\\" />\\n <a href=\\\"#\\\" onclick=\\\"hideModal(this);; return false;\\\">Cancel<\\/a>\\n <\\/p>\\n<\\/form>');\nshowModal('ajax-modal', '400px');\n$('#ajax-modal').addClass('new-watcher');\n". bin/rails test test/functional/watchers_controller_test.rb:200
Files
Actions