Refactor `namespace_projects_resolver_spec.rb` to use less `let`
The namespace_projects_resolver_spec.rb
makes heavy use of let
for groups and projects. This triggers the static analysis bot on MRs
Perhaps this file can be refactored to use let_it_be
The following discussion from !142396 (merged) should be addressed:
-
@project_278964_bot_445da1b60fc7336b6b6776383134d10f started a discussion: let_it_be(:project2) { create(:project, :archived, namespace: namespace) }
Project creations are very slow. To improve test performance, consider using
let_it_be
,build
, orbuild_stubbed
instead.⚠ ️ Warning: If your test modifies data,let_it_be
may be unsuitable, and cause state leaks! Uselet_it_be_with_reload
orlet_it_be_with_refind
instead.Unsure which method to use? See the testing best practices for background information and alternative options for optimizing factory usage.
If you're concerned about causing state leaks, or if you know
let
orlet!
are the better options, ignore this comment.