Commit 0d583e5e authored by Filipa Lacerda's avatar Filipa Lacerda

Creates ref_exists? method for Pipeline class

parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment