diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-08-28 21:10:01 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-03 23:49:10 +0900 |
commit | 4b0e31ba64118011ffc29c31bc771fa2568cd270 (patch) | |
tree | 21f4a5273bf28c514ede0a698b2c2459a3710a75 /spec | |
parent | 6fbb3ce6e93b8dfba795d4542fcb5602c4c82eaf (diff) | |
download | gitlab-ce-4b0e31ba64118011ffc29c31bc771fa2568cd270.tar.gz |
Extend can_pick?
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/runner_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index a04d4615b6b..566b9b48879 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -95,6 +95,8 @@ describe Ci::Runner do let(:build) { create(:ci_build, pipeline: pipeline) } let(:runner) { create(:ci_runner) } + subject { runner.can_pick?(build) } + before do build.project.runners << runner end @@ -222,6 +224,28 @@ describe Ci::Runner do end end end + + context 'when runner is protected' do + before do + runner.protected_! + end + + context 'when build is protected' do + before do + build.protected = true + end + + it { is_expected.to be_truthy } + end + + context 'when build is unprotected' do + before do + build.protected = false + end + + it { is_expected.to be_falsey } + end + end end describe '#status' do |