Force eager loading of the application code for specs require it
What does this MR do and why?
Force eager loading of the application code for specs require it
In !72964 (merged) we disabled eager loading for the test environment. As it was mentioned there are specs that depend on all the application that is being loaded. See !72964 (comment 713060754)
This MR introduces :eager_load
rspec tag and adds this tag to specs
that require it. There are still might be some specs that require this
tag. This MR do not address all the cases from #343878.
Those two still need further investigation:
- https://gitlab.com/gitlab-org/gitlab/blob/8ba2a598bab0475bd6f2ab9ebcef4a1852b8d512/spec/support/before_all_adapter.rb#L5
- https://gitlab.com/gitlab-org/gitlab/blob/452d554d81b0e310ef0e86eb8ea3a1c7bf6fbf90/spec/support/helpers/migrations_helpers.rb#L70 So I am not sure whether we can close the issue after merging this MR.
Adding this tag to the spec would make Rails.application.eager_load!
be called before its execution to load the application code.
See https://api.rubyonrails.org/classes/Rails/Application.html#method-i-eager_load-21
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.