Commit 6fe2adda authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix/pipeline-ref-path-serialization' into 'master'

Do not generate pipeline ref path if ref not present

Closes #26861

See merge request !8658
parents bb6f931b 36afc974
......@@ -40,11 +40,13 @@ class PipelineEntity < Grape::Entity
end
expose :path do |pipeline|
if pipeline.ref
namespace_project_tree_path(
pipeline.project.namespace,
pipeline.project,
id: pipeline.ref)
end
end
expose :tag?, as: :tag
expose :branch?, as: :branch
......
---
title: Do not generate pipeline branch/tag path if not present
merge_request: 8658
author:
......@@ -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
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