Fix flaky spec in project_policy_spec.rb
What does this MR do and why?
While hunting down other flaky specs, I ran across ones in spec/policies/project_policy_spec.rb
.
I am able to recreate with
rspec ./spec/policies/project_policy_spec.rb --seed 54882
Using bisect
as talked about in https://docs.gitlab.com/ee/development/testing_guide/unhealthy_tests.html#how-to-reproduce-a-flaky-test-locally,
rspec ./spec/policies/project_policy_spec.rb --seed 54882 --bisect
I get a minimal recreation
rspec './spec/policies/project_policy_spec.rb[1:7:1:2:1:1,1:57:15:1,1:65:64:8:1]' --seed 54882
Failures are:
rspec './spec/policies/project_policy_spec.rb[1:57:15:1]' # ProjectPolicy environments feature project_visibility: :internal, access_level: 20, role: :guest, allowed: true allows/disallows the abilities based on the environments feature access level
rspec ./spec/policies/project_policy_spec.rb:155 # ProjectPolicy creating_merge_request_in when the current_user can download_code when project is internal when the current_user is guest is expected to be allowed :create_merge_request_in
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.