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
2a80ba27
Commit
2a80ba27
authored
Apr 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for new ci status helper method
parent
3e96b6ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
9 deletions
+38
-9
spec/helpers/ci_status_helper_spec.rb
spec/helpers/ci_status_helper_spec.rb
+38
-9
No files found.
spec/helpers/ci_status_helper_spec.rb
View file @
2a80ba27
...
...
@@ -6,25 +6,54 @@ describe CiStatusHelper do
let
(
:success_commit
)
{
double
(
"Ci::Pipeline"
,
status:
'success'
)
}
let
(
:failed_commit
)
{
double
(
"Ci::Pipeline"
,
status:
'failed'
)
}
describe
'ci_icon_for_status'
do
describe
'
#
ci_icon_for_status'
do
it
'renders to correct svg on success'
do
expect
(
helper
).
to
receive
(
:render
).
with
(
'shared/icons/icon_status_success.svg'
,
anything
)
expect
(
helper
).
to
receive
(
:render
)
.
with
(
'shared/icons/icon_status_success.svg'
,
anything
)
helper
.
ci_icon_for_status
(
success_commit
.
status
)
end
it
'renders the correct svg on failure'
do
expect
(
helper
).
to
receive
(
:render
).
with
(
'shared/icons/icon_status_failed.svg'
,
anything
)
expect
(
helper
).
to
receive
(
:render
)
.
with
(
'shared/icons/icon_status_failed.svg'
,
anything
)
helper
.
ci_icon_for_status
(
failed_commit
.
status
)
end
end
describe
'#ci_text_for_status'
do
context
'when status is manual'
do
it
'changes the status to blocked'
do
expect
(
helper
.
ci_text_for_status
(
'manual'
))
.
to
eq
'blocked'
end
end
context
'when status is success'
do
it
'changes the status to passed'
do
expect
(
helper
.
ci_text_for_status
(
'success'
))
.
to
eq
'passed'
end
end
context
'when status is something else'
do
it
'returns status unchanged'
do
expect
(
helper
.
ci_text_for_status
(
'some-status'
))
.
to
eq
'some-status'
end
end
end
describe
"#pipeline_status_cache_key"
do
let
(
:pipeline_status
)
do
Gitlab
::
Cache
::
Ci
::
ProjectPipelineStatus
.
new
(
build
(
:project
),
sha:
'123abc'
,
status:
'success'
)
end
it
"builds a cache key for pipeline status"
do
pipeline_status
=
Gitlab
::
Cache
::
Ci
::
ProjectPipelineStatus
.
new
(
build
(
:project
),
sha:
"123abc"
,
status:
"success"
)
expect
(
helper
.
pipeline_status_cache_key
(
pipeline_status
)).
to
eq
(
"pipeline-status/123abc-success"
)
expect
(
helper
.
pipeline_status_cache_key
(
pipeline_status
))
.
to
eq
(
"pipeline-status/123abc-success"
)
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