diff options
-rw-r--r-- | app/models/ci/pipeline.rb | 2 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 13 |
2 files changed, 1 insertions, 14 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index a7618ef7e3d..6894a5763ff 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -102,7 +102,7 @@ module Ci end def self.latest_successful_for(ref) - success.latest(ref).order(id: :desc).first + success.latest(ref).first end def self.truncate_sha(sha) diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index f1e9583a7ee..b28da6daabf 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -462,19 +462,6 @@ describe Ci::Pipeline, models: true do end end - describe '.latest_successful_for' do - include_context 'with some outdated pipelines' - - let!(:latest_successful_pipeline) do - create_pipeline(:success, 'ref', 'D') - end - - it 'returns the latest successful pipeline' do - expect(described_class.latest_successful_for('ref')). - to eq(latest_successful_pipeline) - end - end - describe '#status' do let!(:build) { create(:ci_build, :created, pipeline: pipeline, name: 'test') } |