Commit 2a435e1d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Remove Pipeline#latest in favour of Project#pipeline_for(ref)

parent 71046cc6
...@@ -102,10 +102,6 @@ module Ci ...@@ -102,10 +102,6 @@ module Ci
end end
end end
def latest
project.pipelines.latest_for(ref).first
end
def latest? def latest?
return false unless ref return false unless ref
commit = project.commit(ref) commit = project.commit(ref)
......
...@@ -483,7 +483,13 @@ describe Ci::Pipeline, models: true do ...@@ -483,7 +483,13 @@ describe Ci::Pipeline, models: true do
context 'with non-empty project' do context 'with non-empty project' do
let(:project) { create(:project) } 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 describe '#latest?' do
context 'with latest sha' do context 'with latest sha' do
...@@ -503,26 +509,6 @@ describe Ci::Pipeline, models: true do ...@@ -503,26 +509,6 @@ describe Ci::Pipeline, models: true do
end end
end 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 end
describe '#manual_actions' do describe '#manual_actions' 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