Commit ecefe090 authored by Filipa Lacerda's avatar Filipa Lacerda

Render link to branch only when branch still exists

parent 472f2d56
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
= pluralize @pipeline.total_size, "job" = pluralize @pipeline.total_size, "job"
- if @pipeline.ref - if @pipeline.ref
from from
= link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name" - if @project.repository.branch_exists?(@pipeline.ref)
= link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name"
- else
%span.ref-name
= @pipeline.ref
- if @pipeline.duration - if @pipeline.duration
in in
= time_interval_in_words(@pipeline.duration) = time_interval_in_words(@pipeline.duration)
......
---
title: Only render link to branch when branch still exists in pipeline page
merge_request:
author:
type: fixed
...@@ -63,6 +63,11 @@ describe 'Pipeline', :js do ...@@ -63,6 +63,11 @@ describe 'Pipeline', :js do
expect(page).to have_css('#js-tab-pipeline.active') expect(page).to have_css('#js-tab-pipeline.active')
end end
it 'shows link to the pipeline ref' do
expect(page).to have_link(pipeline.ref)
end
it_behaves_like 'showing user status' do it_behaves_like 'showing user status' do
let(:user_with_status) { pipeline.user } let(:user_with_status) { pipeline.user }
...@@ -208,6 +213,18 @@ describe 'Pipeline', :js do ...@@ -208,6 +213,18 @@ describe 'Pipeline', :js do
it { expect(page).not_to have_content('Cancel running') } it { expect(page).not_to have_content('Cancel running') }
end end
end end
context 'with deleted branch' do
before do
DeleteBranchService.new(@project, @user).execute(pipeline.ref)
end
it 'does not render link to the pipeline ref' do
expect(page).not_to have_link(pipeline.ref)
expect(page).to have_content(pipeline.ref)
end
end
end end
context 'when user does not have access to read jobs' do context 'when user does not have access to read jobs' 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