Explicitly require runner owners in specs
What does this MR do and why?
Ensure that all runner objects are valid models, by enforcing the existence of an owner for project and group runners. Previously, it was usual for brevity to do something like:
let(:runner) { create(:ci_runner, :project) }
This would be successful, even though we weren't implicitly creating a project behind the scenes, and therefore the runner wasn't representing a valid state. We now enforce the requirement that a runner is associated with a group or a project. We lean on the pre-existing :without_projects
trait to determine if the runner is supposed not to have projects, and therefore refrain from raising an error in the factory.
Part of #493256 (closed)
Context: !166916 (comment 2130033764)
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.