Skip to content

RSpec: Refind group object to prune memoized values

Peter Leitzen requested to merge pl-spec-group-service-desk-memoized into master

What does this MR do and why?

In !104491 (merged) we started to memoize Group#has_project_with_service_desk_enabled? and this state was leaky between specs when using let_it_be(:group).

Let's use let_it_be_with_refind(:group) instead.

Closes #386135 (closed).

How to set up and validate locally

From #386135 (closed).

bin/rspec ./spec/models/group_spec.rb[1:64:1:1:1,1:64:1:2:1] --order defined --seed 39944 -e has_project_with_service_desk_enabled?

Finished in 22.16 seconds (files took 9 seconds to load
4 examples, 0 failures

On master

git checkout master

bin/rspec ./spec/models/group_spec.rb[1:64:1:1:1,1:64:1:2:1] --order defined --seed 39944 -e has_project_with_service_desk_enabled?

...

Finished in 11.06 seconds (files took 10.04 seconds to load)
4 examples, 2 failures

Failed examples:

rspec ./spec/models/group_spec.rb:2846 # Group has_project_with_service_desk_enabled? when service desk is enabled for subgroup project is expected to eq true
rspec ./spec/models/group_spec.rb:2831 # Group has_project_with_service_desk_enabled? when service desk is enabled for top level group is expected to eq true

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports

Loading