Ensure runner_type is updated correctly when assigning shared runner to project

This commit is contained in:
Dylan Griffith 2018-05-10 11:16:26 +02:00
parent 063b6b75be
commit 84fa061086
2 changed files with 6 additions and 1 deletions

View File

@ -108,7 +108,11 @@ module Ci
end
def assign_to(project, current_user = nil)
self.is_shared = false if shared?
if shared?
self.is_shared = false if shared?
self.runner_type = :project_type
end
self.save
project.runner_projects.create(runner_id: self.id)
end

View File

@ -207,6 +207,7 @@ describe Ci::Runner do
end
it { expect(shared_runner).to be_specific }
it { expect(shared_runner).to be_project_type }
it { expect(shared_runner.projects).to eq([project]) }
it { expect(shared_runner.only_for?(project)).to be_truthy }
end