Skip to content
Snippets Groups Projects
Commit 1f314195 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Do not generate pipeline ref path if ref not present

parent 5a41d92b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -40,10 +40,12 @@ class PipelineEntity < Grape::Entity
end
 
expose :path do |pipeline|
namespace_project_tree_path(
pipeline.project.namespace,
pipeline.project,
id: pipeline.ref)
if pipeline.ref
namespace_project_tree_path(
pipeline.project.namespace,
pipeline.project,
id: pipeline.ref)
end
end
 
expose :tag?, as: :tag
Loading
Loading
Loading
Loading
@@ -134,5 +134,17 @@ describe PipelineEntity do
expect(subject).not_to have_key(:yaml_errors)
end
end
context 'when pipeline ref is empty' do
let(:pipeline) { create(:ci_empty_pipeline) }
before do
allow(pipeline).to receive(:ref).and_return(nil)
end
it 'does not generate branch path' do
expect(subject[:ref][:path]).to be_nil
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment