提交 0d583e5e 编写于 作者: F Filipa Lacerda

Creates ref_exists? method for Pipeline class

上级 fa875ba7
......@@ -268,6 +268,10 @@ module Ci
stage unless stage.statuses_count.zero?
end
def ref_exists?
project.repository.ref_exists?(self.ref)
end
##
# TODO We do not completely switch to persisted stages because of
# race conditions with setting statuses gitlab-ce#23257.
......
......@@ -13,7 +13,7 @@
= pluralize @pipeline.total_size, "job"
- if @pipeline.ref
from
- if @project.repository.branch_exists?(@pipeline.ref)
- if @pipeline.ref_exists?
= link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name"
- else
%span.ref-name
......
......@@ -244,7 +244,7 @@ describe 'Pipeline', :js do
context 'with deleted branch' do
before do
DeleteBranchService.new(@project, @user).execute(pipeline.ref)
allow(pipeline).to receive(:ref_exists?).and_return(false)
end
it 'does not render link to the pipeline ref' do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册