未验证 提交 4b1b2f3b 编写于 作者: A Alexis Reigel 提交者: Alexis Reigel

add Ci::Runner#group? method

上级 32a9c85b
......@@ -139,6 +139,10 @@ module Ci
!shared?
end
def group?
runner_groups.any?
end
def can_pick?(build)
return false if self.ref_protected? && !build.protected?
......
......@@ -642,4 +642,28 @@ describe Ci::Runner do
expect(described_class.search(runner.description.upcase)).to eq([runner])
end
end
describe 'group?' do
it 'returns false when the runner is a project runner' do
project = create :project
runner = create(:ci_runner, description: 'Project runner').tap do |r|
create :ci_runner_project, runner: r, project: project
end
expect(runner.group?).to be false
end
it 'returns false when the runner is a shared runner' do
runner = create :ci_runner, :shared, description: 'Shared runner'
expect(runner.group?).to be false
end
it 'returns true when the runner is assigned to a group' do
group = create :group
runner = create :ci_runner, description: 'Group runner', groups: [group]
expect(runner.group?).to be true
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册