mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Fix flaky tests due to the lack of ordering (#23910)
Why this change?
The following test was flaky due to the lack of ordering in
`SiteSerializer#anonymous_default_navigation_menu_tags` when fetching
the tags.
```
1) SiteSerializer#anonymous_default_navigation_menu_tags includes only tags user can see in the serialised object when user is anonymous
Failure/Error:
expect(serialized[:anonymous_default_navigation_menu_tags]).to eq(
[
{ name: "dev", description: "some description", pm_only: false },
{ name: "random", description: tag2.description, pm_only: false },
],
)
```
What does this change do?
Add ordering by name when fetching tags in `SiteSerializer#anonymous_default_navigation_menu_tags`
This commit is contained in:
committed by
GitHub
parent
700c636d29
commit
81c2d38cea
@@ -278,7 +278,7 @@ class SiteSerializer < ApplicationSerializer
|
||||
SiteSetting.default_navigation_menu_tags.split("|") -
|
||||
DiscourseTagging.hidden_tag_names(scope)
|
||||
|
||||
serialize_tags(Tag.where(name: tag_names))
|
||||
serialize_tags(Tag.where(name: tag_names).order(:name))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user