summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/ci/pipeline.rb4
-rw-r--r--spec/models/ci/pipeline_spec.rb28
2 files changed, 7 insertions, 25 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 50f9ee7fc66..9621bddf8dc 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -102,10 +102,6 @@ module Ci
end
end
- def latest
- project.pipelines.latest_for(ref).first
- end
-
def latest?
return false unless ref
commit = project.commit(ref)
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 556a6e1b59a..2dbc3d985b0 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -483,7 +483,13 @@ describe Ci::Pipeline, models: true do
context 'with non-empty project' do
let(:project) { create(:project) }
- let(:pipeline) { create_pipeline }
+
+ let(:pipeline) do
+ create(:ci_pipeline,
+ project: project,
+ ref: project.default_branch,
+ sha: project.commit.sha)
+ end
describe '#latest?' do
context 'with latest sha' do
@@ -503,26 +509,6 @@ describe Ci::Pipeline, models: true do
end
end
end
-
- describe '#latest' do
- let(:previous_pipeline) { create_pipeline }
-
- before do
- previous_pipeline
- pipeline
- end
-
- it 'gives the latest pipeline' do
- expect(previous_pipeline.latest).to eq(pipeline)
- end
- end
-
- def create_pipeline
- create(:ci_pipeline,
- project: project,
- ref: project.default_branch,
- sha: project.commit.sha)
- end
end
describe '#manual_actions' do