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)