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
Jérome Perrin
gitlab-ce
Commits
9f127918
Commit
9f127918
authored
Jan 11, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extended status for build failed but allowed to
parent
e5d53df7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
137 additions
and
0 deletions
+137
-0
lib/gitlab/ci/status/build/failed_allowed.rb
lib/gitlab/ci/status/build/failed_allowed.rb
+27
-0
spec/lib/gitlab/ci/status/build/failed_allowed_spec.rb
spec/lib/gitlab/ci/status/build/failed_allowed_spec.rb
+110
-0
No files found.
lib/gitlab/ci/status/build/failed_allowed.rb
0 → 100644
View file @
9f127918
module
Gitlab
module
Ci
module
Status
module
Build
class
FailedAllowed
<
SimpleDelegator
include
Status
::
Extended
def
label
'failed (allowed to fail)'
end
def
icon
'icon_status_warning'
end
def
group
'failed_with_warnings'
end
def
self
.
matches?
(
build
,
user
)
build
.
failed?
&&
build
.
allow_failure?
end
end
end
end
end
end
spec/lib/gitlab/ci/status/build/failed_allowed_spec.rb
0 → 100644
View file @
9f127918
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
FailedAllowed
do
let
(
:status
)
{
double
(
'core status'
)
}
let
(
:user
)
{
double
(
'user'
)
}
subject
do
described_class
.
new
(
status
)
end
describe
'#text'
do
it
'does not override status text'
do
expect
(
status
).
to
receive
(
:text
)
subject
.
text
end
end
describe
'#icon'
do
it
'returns a warning icon'
do
expect
(
subject
.
icon
).
to
eq
'icon_status_warning'
end
end
describe
'#label'
do
it
'returns information about failed but allowed to fail status'
do
expect
(
subject
.
label
).
to
eq
'failed (allowed to fail)'
end
end
describe
'#group'
do
it
'returns status failed with warnings status group'
do
expect
(
subject
.
group
).
to
eq
'failed_with_warnings'
end
end
describe
'action details'
do
describe
'#has_action?'
do
it
'does not decorate action details'
do
expect
(
status
).
to
receive
(
:has_action?
)
subject
.
has_action?
end
end
describe
'#action_path'
do
it
'does not decorate action path'
do
expect
(
status
).
to
receive
(
:action_path
)
subject
.
action_path
end
end
describe
'#action_icon'
do
it
'does not decorate action icon'
do
expect
(
status
).
to
receive
(
:action_icon
)
subject
.
action_icon
end
end
describe
'#action_title'
do
it
'does not decorate action title'
do
expect
(
status
).
to
receive
(
:action_title
)
subject
.
action_title
end
end
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is failed'
do
context
'when build is allowed to fail'
do
let
(
:build
)
{
create
(
:ci_build
,
:failed
,
:allowed_to_fail
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not allowed to fail'
do
let
(
:build
)
{
create
(
:ci_build
,
:failed
)
}
it
'is not a correct match'
do
expect
(
subject
).
not_to
be
true
end
end
end
context
'when build did not fail'
do
context
'when build is allowed to fail'
do
let
(
:build
)
{
create
(
:ci_build
,
:success
,
:allowed_to_fail
)
}
it
'is not a correct match'
do
expect
(
subject
).
not_to
be
true
end
end
context
'when build is not allowed to fail'
do
let
(
:build
)
{
create
(
:ci_build
,
:success
)
}
it
'is not a correct match'
do
expect
(
subject
).
not_to
be
true
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