Do not allow to trigger manual actions that were skipped

This commit is contained in:
Grzegorz Bizon 2018-05-16 14:02:04 +02:00
parent a78b1b27b8
commit 3a94919e83
2 changed files with 41 additions and 1 deletions

View File

@ -184,7 +184,7 @@ module Ci
end end
def playable? def playable?
action? && (manual? || complete?) action? && (manual? || retryable?)
end end
def action? def action?

View File

@ -1270,6 +1270,46 @@ describe Ci::Build do
end end
end end
describe '#playable?' do
context 'when build is a manual action' do
context 'when build has been skipped' do
subject { build_stubbed(:ci_build, :manual, status: :skipped) }
it { is_expected.not_to be_playable }
end
context 'when build has been canceled' do
subject { build_stubbed(:ci_build, :manual, status: :canceled) }
it { is_expected.to be_playable }
end
context 'when build is successful' do
subject { build_stubbed(:ci_build, :manual, status: :success) }
it { is_expected.to be_playable }
end
context 'when build has failed' do
subject { build_stubbed(:ci_build, :manual, status: :failed) }
it { is_expected.to be_playable }
end
context 'when build is a manual untriggered action' do
subject { build_stubbed(:ci_build, :manual, status: :manual) }
it { is_expected.to be_playable }
end
end
context 'when build is not a manual action' do
subject { build_stubbed(:ci_build, :success) }
it { is_expected.not_to be_playable }
end
end
describe 'project settings' do describe 'project settings' do
describe '#allow_git_fetch' do describe '#allow_git_fetch' do
it 'return project allow_git_fetch configuration' do it 'return project allow_git_fetch configuration' do