diff options
author | James Lopez <james@gitlab.com> | 2018-05-11 13:32:43 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2018-05-11 13:32:43 +0300 |
commit | f811495e86aff85b0b9729b40a5fd00973157261 (patch) | |
tree | 814d2783e97a4001af1cf01b509920ad5d31dbbe /spec | |
parent | 3a7d28597e3e23ef497186891662b4a85d013b08 (diff) | |
parent | 7c3e42f0196fdd13a61436d83c66418ca8ea6c3b (diff) |
Merge branch '10-8-stable-prepare-rc8-fix-conflict-for-18874' into '10-8-stable-prepare-rc8'
Fixes conflict when picking into prep branch
See merge request gitlab-org/gitlab-ce!18900
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/runner_spec.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index cc4d4e5e4ae..4c1d3c712f4 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -198,16 +198,30 @@ describe Ci::Runner do end describe '#assign_to' do - let!(:project) { FactoryBot.create :project } - let!(:shared_runner) { FactoryBot.create(:ci_runner, :shared) } + let!(:project) { FactoryBot.create(:project) } - before do - shared_runner.assign_to(project) + subject { runner.assign_to(project) } + + context 'with shared runner' do + let!(:runner) { FactoryBot.create(:ci_runner, :shared) } + + it 'transitions shared runner to project runner and assigns project' do + subject + expect(runner).to be_specific + expect(runner).to be_project_type + expect(runner.projects).to eq([project]) + expect(runner.only_for?(project)).to be_truthy + end end - it { expect(shared_runner).to be_specific } - it { expect(shared_runner.projects).to eq([project]) } - it { expect(shared_runner.only_for?(project)).to be_truthy } + context 'with group runner' do + let!(:runner) { FactoryBot.create(:ci_runner, runner_type: :group_type) } + + it 'raises an error' do + expect { subject } + .to raise_error(ArgumentError, 'Transitioning a group runner to a project runner is not supported') + end + end end describe '.online' do |