Improve code coverage for app/models/user.rb
Fix the test gaps reported for this file on https://gitlab-org.gitlab.io/gitlab/coverage-ruby/
Note that for this one, there are multiple gaps in the testing but not all are necessarily relevant to this epic and work.
As of 00769538, the current coverage gaps for User
(https://gitlab-org.gitlab.io/gitlab/coverage-ruby/#35c38ceff63c512a6a8b1f4d336518a9b805040d) are:
From line 1367 - Remove User#name_with_username as no longer in use (!139877 - merged):
+ def name_with_username
- "#{name} (#{username})"
end
From line 1500 - Remove User#with_defaults as no longer in use (!139872 - merged):
+ def with_defaults
- User.defaults.each do |k, v|
- public_send("#{k}=", v) # rubocop:disable GitlabSecurity/PublicSend
end
- self
end
From line 2809 - Add missing coverage for #max_member_access_for... (!139874 - merged):
+ def max_member_access_for_group(group_id)
- max_member_access_for_group_ids([group_id])[group_id]
end
Related: https://gitlab.com/gitlab-org/gitlab/-/issues/43562+
Edited by Ash McKenzie