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
123da5fb
Commit
123da5fb
authored
Oct 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for pipeline failure reason presenter
Conflicts: app/presenters/ci/pipeline_presenter.rb
parent
ffce9fd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
app/presenters/ci/pipeline_presenter.rb
app/presenters/ci/pipeline_presenter.rb
+5
-1
spec/presenters/ci/pipeline_presenter_spec.rb
spec/presenters/ci/pipeline_presenter_spec.rb
+17
-0
spec/serializers/pipeline_entity_spec.rb
spec/serializers/pipeline_entity_spec.rb
+13
-0
No files found.
app/presenters/ci/pipeline_presenter.rb
View file @
123da5fb
module
Ci
module
Ci
class
PipelinePresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
class
PipelinePresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
FAILURE_REASONS
=
{}
FAILURE_REASONS
=
{
config_error:
'CI/CD YAML configuration error!'
}.
freeze
presents
:pipeline
def
failure_reason
def
failure_reason
return
unless
pipeline
.
failure_reason?
return
unless
pipeline
.
failure_reason?
...
...
spec/presenters/ci/pipeline_presenter_spec.rb
View file @
123da5fb
...
@@ -51,4 +51,21 @@ describe Ci::PipelinePresenter do
...
@@ -51,4 +51,21 @@ describe Ci::PipelinePresenter do
end
end
end
end
end
end
context
'#failure_reason'
do
context
'when pipeline has failure reason'
do
it
'represents a failure reason sentence'
do
pipeline
.
failure_reason
=
:config_error
expect
(
presenter
.
failure_reason
)
.
to
eq
'CI/CD YAML configuration error!'
end
end
context
'when pipeline does not have failure reason'
do
it
'returns nil'
do
expect
(
presenter
.
failure_reason
).
to
be_nil
end
end
end
end
end
spec/serializers/pipeline_entity_spec.rb
View file @
123da5fb
...
@@ -108,5 +108,18 @@ describe PipelineEntity do
...
@@ -108,5 +108,18 @@ describe PipelineEntity do
expect
(
subject
[
:ref
][
:path
]).
to
be_nil
expect
(
subject
[
:ref
][
:path
]).
to
be_nil
end
end
end
end
context
'when pipeline has a failure reason set'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
before
do
pipeline
.
drop!
(
:config_error
)
end
it
'has a correct failure reason'
do
expect
(
subject
[
:failure_reason
])
.
to
eq
'CI/CD YAML configuration error!'
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