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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
93be669e
Commit
93be669e
authored
Jun 26, 2019
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor pipeline errors_message
Use the shared method in Ci::Pipeline
parent
19dc1105
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-0
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+24
-0
No files found.
app/models/ci/pipeline.rb
View file @
93be669e
...
...
@@ -790,6 +790,10 @@ module Ci
stages
.
find_by!
(
name:
name
)
end
def
error_messages
errors
?
errors
.
full_messages
.
to_sentence
:
""
end
private
def
ci_yaml_from_repo
...
...
app/services/ci/create_pipeline_service.rb
View file @
93be669e
...
...
@@ -65,7 +65,7 @@ module Ci
def
execute!
(
*
args
,
&
block
)
execute
(
*
args
,
&
block
).
tap
do
|
pipeline
|
unless
pipeline
.
persisted?
raise
CreateError
,
pipeline
.
error
s
.
full_messages
.
join
(
','
)
raise
CreateError
,
pipeline
.
error
_messages
end
end
end
...
...
spec/models/ci/pipeline_spec.rb
View file @
93be669e
...
...
@@ -2998,4 +2998,28 @@ describe Ci::Pipeline, :mailer do
end
end
end
describe
'#error_messages'
do
subject
{
pipeline
.
error_messages
}
before
do
pipeline
.
valid?
end
context
'when pipeline has errors'
do
let
(
:pipeline
)
{
build
(
:ci_pipeline
,
sha:
nil
,
ref:
nil
)
}
it
'returns the full error messages'
do
is_expected
.
to
eq
(
"Sha can't be blank and Ref can't be blank"
)
end
end
context
'when pipeline does not have errors'
do
let
(
:pipeline
)
{
build
(
:ci_pipeline
)
}
it
'returns empty string'
do
is_expected
.
to
be_empty
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