Creates ref_exists? method for Pipeline class
This commit is contained in:
parent
fa875ba7a9
commit
0d583e5e8a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue