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
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-08-28 15:10:01 +0300
committerShinya Maeda <shinya@gitlab.com>2017-09-03 17:49:10 +0300
commit4b0e31ba64118011ffc29c31bc771fa2568cd270 (patch)
tree21f4a5273bf28c514ede0a698b2c2459a3710a75 /spec/models/ci/runner_spec.rb
parent6fbb3ce6e93b8dfba795d4542fcb5602c4c82eaf (diff)
Extend can_pick?
Diffstat (limited to 'spec/models/ci/runner_spec.rb')
-rw-r--r--spec/models/ci/runner_spec.rb24
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