Skip to content

Place shared examples in the support folder

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/191481 we enabled the Gitlab/RSpec/SharedExamplesPlacement cop which requires our Rspec.shared_examples to be placed in the support folder. Inline definitions without Rspec constant can be used in the same file.

Implementation Plan

  • For each of the following files (.rubocop_todo/gitlab/rspec/shared_examples_placement.yml), understand the cop purpose by looking at the specs.
  • Switch to inline shared example in case of single file usage.
  • Or place shared examples in spec/support/shared_examples/ or ee/spec/support/shared_examples/
  • Run bundle exec rubocop --only Gitlab/RSpec/SharedExamplesPlacement and ensure there are no errors.
Edited by Serhii Yarynovskyi