DEV: Restore order assertion in category serializer tests. (#16344)

Our group fabrication creates groups with name "my_group_#{n}" where n
is the sequence number of the group being created. However, this can
cause the test to be flaky if and when a group with name `my_group_10`
is created as it will be ordered before
`my_group_9`. This commits makes the group names determinstic to
eliminate any flakiness.

This reverts commit 558bc6b746928a1fcdb2773b0447ea4a57aa7419.
This commit is contained in:
Alan Guo Xiang Tan
2022-04-01 08:58:06 +08:00
committed by GitHub
parent 4b93dba82f
commit e7c3d01aaa
3 changed files with 15 additions and 13 deletions

View File

@ -142,7 +142,7 @@ class Group < ActiveRecord::Base
scope :with_smtp_configured, -> { where(smtp_enabled: true) }
scope :visible_groups, Proc.new { |user, order, opts|
groups = self.order(order || "name ASC")
groups = self.order(order || "groups.name ASC")
if !opts || !opts[:include_everyone]
groups = groups.where("groups.id > 0")