提交 2a435e1d 编写于 作者: L Lin Jen-Shin

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

上级 71046cc6
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册