diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-07-20 16:38:38 +0200 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-07-20 16:38:38 +0200 |
| commit | 30f375cf5f5b5ca1d708c6f9558308a1d57cbd71 (patch) | |
| tree | 515faf1911f55af2aede9af4638eb624b48aefcd | |
| parent | f3d03af4215763d6c51c4b26702200ba679baded (diff) | |
| download | gitlab-ce-30f375cf5f5b5ca1d708c6f9558308a1d57cbd71.tar.gz | |
Don't show other actions of the same name
| -rw-r--r-- | app/models/ci/build.rb | 2 | ||||
| -rw-r--r-- | spec/models/build_spec.rb | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 21c0e128b98..58f25b20acf 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -97,7 +97,7 @@ module Ci end def other_actions - pipeline.manual_actions.where.not(id: self) + pipeline.manual_actions.where.not(name: name) end def playable? diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index f9c9725a23d..2de305738cc 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -808,6 +808,22 @@ describe Ci::Build, models: true do it 'returns other actions' do is_expected.to contain_exactly(other_build) end + + context 'when build is retried' do + let!(:new_build) { Ci::Build.retry(build) } + + it 'does not return any of them' do + is_expected.not_to include(build, new_build) + end + end + + context 'when other build is retried' do + let!(:retried_build) { Ci::Build.retry(other_build) } + + it 'returns a retried build' do + is_expected.to contain_exactly(retried_build) + end + end end describe '#play' do |
