From 0a2f5065f26f259ed66359f3754ecc21505fea0d Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Mon, 14 May 2018 15:54:47 +0200 Subject: Ensure we validate Runner#runner_type when persisting RunnerNamespace --- spec/models/ci/runner_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec') diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 4dc990350d2..51d5e666cd6 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -66,6 +66,13 @@ describe Ci::Runner do expect(instance_runner).not_to be_valid expect(instance_runner.errors.full_messages).to include('Runner cannot assign project to a non-project runner') end + + it 'should fail to save a group assigned to a project runner even if the runner is already saved' do + group_runner + + expect { create(:group, runners: [project_runner]) } + .to raise_error(ActiveRecord::RecordInvalid) + end end end -- cgit v1.2.1