Fix let_it_be usage in nuget_packages_spec.rb
What does this MR do?
During the maintainer review of !24182 (merged), it has been discussed that nuget_packages_spec.rb
was using let_it_be(:project)
in a non straightforward way: before
/after
callbacks were still needed in the examples.
This MR aims to fix that. We still keep let_it_be
for faster test execution times but with reload: true
. This way, the project
gets project.reload
between examples and we can drop all the after
callbacks.
Detailed explanations:
-
nuget_packages_spec
heavily use table based tests to check different user permissions and different project visibilities. See https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/spec/requests/api/nuget_packages_spec.rb#L101-120 for an example. - the
project
object is created bylet_it_be
in a public visibility. Abefore
callback is used to set the correct visibility expected by the example. - Previously, a
after
callback was used to put back the public visibility. With this MR, this is no longer necessary aslet_it_be(:project, reload: true)
will automatically callproject.reload
after each example and thus rollback the visibility to public.
See !24182 (comment 287345202) and #205595 (closed)
Screenshots
n/a
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by David Fernandez