Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-05-11 11:13:27 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-05-11 12:45:06 +0300
commitc9a6f7cb401de7f04a66aec7198e9bd4a5fa615b (patch)
tree7ca1f141cadf3ff722d0708ae51c1cbb1a55081a /spec
parent04ab2f1f021ff4f3e732da6ebbdfcb967c63f037 (diff)
Merge branch 'correct-runner-type-when-assigning-shared-to-project' into 'master'
Ensure runner_type is updated correctly when assigning shared runner to project See merge request gitlab-org/gitlab-ce!18874
Diffstat (limited to 'spec')
-rw-r--r--spec/models/ci/runner_spec.rb29
1 files changed, 24 insertions, 5 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index cc4d4e5e4ae..ef769a617ed 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -198,16 +198,35 @@ describe Ci::Runner do
end
describe '#assign_to' do
+<<<<<<< HEAD
let!(:project) { FactoryBot.create :project }
let!(:shared_runner) { FactoryBot.create(:ci_runner, :shared) }
+=======
+ let!(:project) { FactoryBot.create(:project) }
+>>>>>>> f91aaccf4d0... Merge branch 'correct-runner-type-when-assigning-shared-to-project' into 'master'
- 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