Commit 38759832 authored by Shinya Maeda's avatar Shinya Maeda

Impprove spec by godfat suggestions

parent 4b0e31ba
...@@ -23,11 +23,11 @@ FactoryGirl.define do ...@@ -23,11 +23,11 @@ FactoryGirl.define do
end end
trait :protected do trait :protected do
access_level Ci::Runner.access_levels['protected_'] access_level 'protected_'
end end
trait :unprotected do trait :unprotected do
access_level Ci::Runner.access_levels['unprotected'] access_level 'unprotected'
end end
end end
end end
...@@ -26,8 +26,17 @@ describe Gitlab::Ci::Stage::Seed do ...@@ -26,8 +26,17 @@ describe Gitlab::Ci::Stage::Seed do
expect(subject.builds).to all(include(project: pipeline.project)) expect(subject.builds).to all(include(project: pipeline.project))
expect(subject.builds) expect(subject.builds)
.to all(include(trigger_request: pipeline.trigger_requests.first)) .to all(include(trigger_request: pipeline.trigger_requests.first))
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)) expect(subject.builds).to all(include(protected: true))
end end
end
context 'when a ref is unprotected' do context 'when a ref is unprotected' do
before do before do
......
...@@ -192,7 +192,7 @@ describe API::Runners do ...@@ -192,7 +192,7 @@ describe API::Runners do
tag_list: ['ruby2.1', 'pgsql', 'mysql'], tag_list: ['ruby2.1', 'pgsql', 'mysql'],
run_untagged: 'false', run_untagged: 'false',
locked: 'true', locked: 'true',
access_level: 1) access_level: Ci::Runner.access_levels['protected_'])
shared_runner.reload shared_runner.reload
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment