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
d5e16807
Commit
d5e16807
authored
Dec 14, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
016af097
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
8 deletions
+20
-8
app/helpers/icons_helper.rb
app/helpers/icons_helper.rb
+3
-1
app/presenters/ci/pipeline_presenter.rb
app/presenters/ci/pipeline_presenter.rb
+3
-1
spec/helpers/icons_helper_spec.rb
spec/helpers/icons_helper_spec.rb
+2
-0
spec/presenters/ci/pipeline_presenter_spec.rb
spec/presenters/ci/pipeline_presenter_spec.rb
+12
-6
No files found.
app/helpers/icons_helper.rb
View file @
d5e16807
...
@@ -42,7 +42,7 @@ module IconsHelper
...
@@ -42,7 +42,7 @@ module IconsHelper
end
end
def
sprite_icon
(
icon_name
,
size:
nil
,
css_class:
nil
)
def
sprite_icon
(
icon_name
,
size:
nil
,
css_class:
nil
)
unless
known_sprites
.
in
clude?
(
icon_name
)
if
known_sprites
&
.
ex
clude?
(
icon_name
)
exception
=
ArgumentError
.
new
(
"
#{
icon_name
}
is not a known icon in @gitlab-org/gitlab-svg"
)
exception
=
ArgumentError
.
new
(
"
#{
icon_name
}
is not a known icon in @gitlab-org/gitlab-svg"
)
Gitlab
::
Sentry
.
track_and_raise_for_dev_exception
(
exception
)
Gitlab
::
Sentry
.
track_and_raise_for_dev_exception
(
exception
)
end
end
...
@@ -156,6 +156,8 @@ module IconsHelper
...
@@ -156,6 +156,8 @@ module IconsHelper
private
private
def
known_sprites
def
known_sprites
return
if
Rails
.
env
.
production?
@known_sprites
||=
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
'node_modules/@gitlab/svgs/dist/icons.json'
)))[
'icons'
]
@known_sprites
||=
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
'node_modules/@gitlab/svgs/dist/icons.json'
)))[
'icons'
]
end
end
end
end
app/presenters/ci/pipeline_presenter.rb
View file @
d5e16807
...
@@ -8,7 +8,9 @@ module Ci
...
@@ -8,7 +8,9 @@ module Ci
# We use a class method here instead of a constant, allowing EE to redefine
# We use a class method here instead of a constant, allowing EE to redefine
# the returned `Hash` more easily.
# the returned `Hash` more easily.
def
self
.
failure_reasons
def
self
.
failure_reasons
{
config_error:
'CI/CD YAML configuration error!'
}
{
unknown_failure:
'Unknown pipeline failure!'
,
config_error:
'CI/CD YAML configuration error!'
,
external_validation_failure:
'External pipeline validation failed!'
}
end
end
presents
:pipeline
presents
:pipeline
...
...
spec/helpers/icons_helper_spec.rb
View file @
d5e16807
...
@@ -76,6 +76,8 @@ describe IconsHelper do
...
@@ -76,6 +76,8 @@ describe IconsHelper do
it
'does not raise in production mode'
do
it
'does not raise in production mode'
do
stub_rails_env
(
'production'
)
stub_rails_env
(
'production'
)
expect
(
File
).
not_to
receive
(
:read
)
expect
{
sprite_icon
(
non_existing
)
}.
not_to
raise_error
expect
{
sprite_icon
(
non_existing
)
}.
not_to
raise_error
end
end
end
end
...
...
spec/presenters/ci/pipeline_presenter_spec.rb
View file @
d5e16807
...
@@ -62,13 +62,19 @@ describe Ci::PipelinePresenter do
...
@@ -62,13 +62,19 @@ describe Ci::PipelinePresenter do
end
end
end
end
context
'#failure_reason'
do
describe
'#failure_reason'
do
context
'when pipeline has failure reason'
do
context
'when pipeline has a failure reason'
do
it
'represents a failure reason sentence'
do
::
Ci
::
PipelineEnums
.
failure_reasons
.
keys
.
each
do
|
failure_reason
|
pipeline
.
failure_reason
=
:config_error
context
"when failure reason is
#{
failure_reason
}
"
do
before
do
pipeline
.
failure_reason
=
failure_reason
end
expect
(
presenter
.
failure_reason
)
it
'represents a failure reason sentence'
do
.
to
eq
'CI/CD YAML configuration error!'
expect
(
presenter
.
failure_reason
).
to
be_an_instance_of
(
String
)
expect
(
presenter
.
failure_reason
).
not_to
eq
(
failure_reason
.
to_s
)
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