Skip to content

Refactor specs

Pedro Pombeiro requested to merge pedropombeiro/460721/1-refactor-specs into master

What does this MR do and why?

This MR does not change any functionality, it just refactors spec/requests/api/ci/runners_spec.rb in order to make it more flexible. These changes will be needed for the follow-up !152528 (closed), where we'll start testing token scopes on these requests.

The gist of the changes is as follows:

  • extract the request into a perform_request subject, and any arguments into their own let statements (e.g. path, query, and extra_query_parts)
  • introduce contexts that perform the setup, instead of doing both the setup and action in the test
  • move admin_mode: true from the request into the parent context

Part of #460721 (closed)

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.

n/a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

n/a

Edited by Pedro Pombeiro

Merge request reports