Share the Artifact Registry feature spec setup in shared contexts
What does this MR do and why?
Moves the setup that five Artifact Registry feature specs each copied into two shared contexts, so a new page spec includes it instead of adding another copy. Test-only; no production change.
The new file is ee/spec/support/shared_contexts/features/artifact_registry/repositories_shared_contexts.rb:
'with a signed-in organization member and an active Artifact Registry': the namespace mapping faked as an active registry (slugacme), the signed-in organization member, the client double, andrepositories_base_path.'with a repository the Artifact Registry client returns': the repository attributes, the all-allowed repository verdicts, and the twoclient.repositoryreads (with and without permissions). Groups that need different repository data merge their keys ontodefault_repository_attributes, because a let in the including group cannot reach the context's let withsuper().
Specs that now include them: repositories_spec.rb, versions_spec.rb, version_detail_spec.rb, manifest_detail_spec.rb, and repository_access_spec.rb. The issue counted four; repository_access_spec.rb landed on master afterwards with a fifth copy. setup_spec.rb stays as it is: it signs in an organization owner, uses another slug, and creates the mapping after the page loads.
Two changes beyond the move:
- The
verdictslet is nowrepository_verdicts.repositories_spec.rbdefines averdicts(scope, read, allowed)helper method, and a same-named let in a nested group would shadow it. repositories_spec.rb's "boots the Vue SPA shell" example now stubs an empty repositories list.
Why the boot example changed
On master it was the only example in its group without a fake client, so it ran the real one against the test configuration. The shared context fakes the client for the whole file, and an unstubbed call on the double raises RSpec::Mocks::MockExpectationError. That is an Exception, not a StandardError, so it escapes the GraphQL controller and fails the example as a server error. Stubbing an empty page keeps the example to what it asserts (the shell boots) and no longer depends on whether an Artifact Registry is reachable.
No changelog: test-only change.
References
- Item 6 of #630526 (closed), the last open one; items 1 to 5 shipped in !259640 (merged)
- Related: #634501 (closed), the same kind of extraction for the frontend fixture generators, in review in !265780 (merged). It stubs a different, HTTP-level setup and touches none of these files.
Closes #630526 (closed)
Screenshots or screen recordings
Not applicable; test-only change.
How to set up and validate locally
Not applicable; there is no manual step to see a test-only change. CI runs the five feature specs.
What was checked locally
- The five specs on master and on this branch, run the same way: every example has the same result. The only failures were the same five on both sides. They come from running against a local Vite dev build (Vue dev-mode console warnings, a breadcrumb render, a focus-return timing) and are unrelated to this change. A few other examples timed out once at a load average near 50 and passed on rerun; the one checked side by side ("renders the versions the connection returned") failed once on master's copy too.
- Mutation: when the shared
permissionsignoresrepository_verdicts, both "renders no actions menu" examples (version and manifest pages) fail with the actions menu rendered, so the override still reaches the shared verdicts. - RuboCop: no offenses.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.