Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
1f314195
Commit
1f314195
authored
Jan 20, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not generate pipeline ref path if ref not present
parent
5a41d92b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
app/serializers/pipeline_entity.rb
app/serializers/pipeline_entity.rb
+6
-4
spec/serializers/pipeline_entity_spec.rb
spec/serializers/pipeline_entity_spec.rb
+12
-0
No files found.
app/serializers/pipeline_entity.rb
View file @
1f314195
...
@@ -40,11 +40,13 @@ class PipelineEntity < Grape::Entity
...
@@ -40,11 +40,13 @@ class PipelineEntity < Grape::Entity
end
end
expose
:path
do
|
pipeline
|
expose
:path
do
|
pipeline
|
if
pipeline
.
ref
namespace_project_tree_path
(
namespace_project_tree_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
project
,
id:
pipeline
.
ref
)
id:
pipeline
.
ref
)
end
end
end
expose
:tag?
,
as: :tag
expose
:tag?
,
as: :tag
expose
:branch?
,
as: :branch
expose
:branch?
,
as: :branch
...
...
spec/serializers/pipeline_entity_spec.rb
View file @
1f314195
...
@@ -134,5 +134,17 @@ describe PipelineEntity do
...
@@ -134,5 +134,17 @@ describe PipelineEntity do
expect
(
subject
).
not_to
have_key
(
:yaml_errors
)
expect
(
subject
).
not_to
have_key
(
:yaml_errors
)
end
end
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
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment