Commit 3a94919e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Do not allow to trigger manual actions that were skipped

parent a78b1b27
...@@ -184,7 +184,7 @@ module Ci ...@@ -184,7 +184,7 @@ module Ci
end end
def playable? def playable?
action? && (manual? || complete?) action? && (manual? || retryable?)
end end
def action? def action?
......
...@@ -1270,6 +1270,46 @@ describe Ci::Build do ...@@ -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
......
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