Skip to content

Optimize the `award_user_list` helper spec

Robert Speicher requested to merge rs-optimize-award_user_list-spec into master

According to https://gitlab.com/gitlab-org/gitlab-ce/issues/23034#note_16586657, each test for this helper generated 1,833 queries.

Now we only generate stubbed records, and only as many as we need for each test.

This also corrects a slight logic bug in the helper itself. When the number of awards was greater than the limit (9 by default), and the current user was one of them, we actually included 10 names, including "You", plus the remaining count. Now we return the correct number regardless.

Merge request reports