Impprove spec by godfat suggestions

This commit is contained in:
Shinya Maeda 2017-08-28 21:40:52 +09:00
parent 4b0e31ba64
commit 3875983205
3 changed files with 13 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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)