Add shared_context for protected ref access specs
What does this MR do and why?
Add shared_context for protected ref access specs
All of our protected ref access spec have very similar configurations. This change extracts the common objects into a shared context.
The association was previously passed to the shared_examples but this new shared_context can find the correct association without needing to pass it so we no longer need to pass :protected_branch or :protected_tag when including the examples into a spec.
A number of duplicated variables have been removed.
We were previously including shared_examples with include_examples. However, include_examples leaks state which was causing these specs to interact with each other. This was only evident after adding the shared_context. We have now switched to using it_behaves_like which wraps the examples in a context block, isolating the state from the parent spec.
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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.