diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-08-28 21:40:52 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-03 23:49:10 +0900 |
commit | 3875983205fd3cdbdc93f18b118deaf098d75af1 (patch) | |
tree | 72d9f2e1099555d0766919df79d46fcbf1275148 | |
parent | 4b0e31ba64118011ffc29c31bc771fa2568cd270 (diff) | |
download | gitlab-ce-3875983205fd3cdbdc93f18b118deaf098d75af1.tar.gz |
Impprove spec by godfat suggestions
-rw-r--r-- | spec/factories/ci/runners.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/stage/seed_spec.rb | 11 | ||||
-rw-r--r-- | spec/requests/api/runners_spec.rb | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb index 3a7da2e47d0..e563a14ce08 100644 --- a/spec/factories/ci/runners.rb +++ b/spec/factories/ci/runners.rb @@ -23,11 +23,11 @@ FactoryGirl.define do end trait :protected do - access_level Ci::Runner.access_levels['protected_'] + access_level 'protected_' end trait :unprotected do - access_level Ci::Runner.access_levels['unprotected'] + access_level 'unprotected' end end end diff --git a/spec/lib/gitlab/ci/stage/seed_spec.rb b/spec/lib/gitlab/ci/stage/seed_spec.rb index 1e9cbbdfb77..515e06e38e5 100644 --- a/spec/lib/gitlab/ci/stage/seed_spec.rb +++ b/spec/lib/gitlab/ci/stage/seed_spec.rb @@ -26,7 +26,16 @@ describe Gitlab::Ci::Stage::Seed do expect(subject.builds).to all(include(project: pipeline.project)) expect(subject.builds) .to all(include(trigger_request: pipeline.trigger_requests.first)) - expect(subject.builds).to all(include(protected: true)) + end + + context 'when a ref is protected' do + before do + allow_any_instance_of(Project).to receive(:protected_for?).and_return(true) + end + + it 'returns unprotected builds' do + expect(subject.builds).to all(include(protected: true)) + end end context 'when a ref is unprotected' do diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb index b8d98818a8c..5a6edad8118 100644 --- a/spec/requests/api/runners_spec.rb +++ b/spec/requests/api/runners_spec.rb @@ -192,7 +192,7 @@ describe API::Runners do tag_list: ['ruby2.1', 'pgsql', 'mysql'], run_untagged: 'false', locked: 'true', - access_level: 1) + access_level: Ci::Runner.access_levels['protected_']) shared_runner.reload expect(response).to have_http_status(200) |