Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
86052e6c
Commit
86052e6c
authored
Jan 17, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add view specs for ci/cd detailed status badge
parent
e5bafed8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
spec/views/ci/status/_badge.html.haml_spec.rb
spec/views/ci/status/_badge.html.haml_spec.rb
+85
-0
No files found.
spec/views/ci/status/_badge.html.haml_spec.rb
0 → 100644
View file @
86052e6c
require
'spec_helper'
describe
'ci/status/_badge'
,
:view
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:private
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
context
'when rendering status for build'
do
let
(
:resource
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
)
}
let
(
:details_path
)
do
namespace_project_build_path
(
resource
.
project
.
namespace
,
resource
.
project
,
resource
)
end
context
'when status has details'
do
before
do
user_with_role
(
:developer
)
{
render_status
}
end
it
'has link to build details page'
do
expect
(
rendered
).
to
have_link
'passed'
,
href:
details_path
end
end
context
'when status does not have details'
do
before
{
render_status
}
it
'contains build status text'
do
expect
(
rendered
).
to
have_content
'passed'
end
it
'does not contain links'
do
expect
(
rendered
).
not_to
have_link
'passed'
end
end
end
context
'when rendering status for external job'
do
before
do
user_with_role
(
:developer
)
{
render_status
}
end
context
'status has external target url'
do
let
(
:resource
)
do
create
(
:generic_commit_status
,
status: :running
,
pipeline:
pipeline
,
target_url:
'http://gitlab.com'
)
end
it
'contains valid commit status text'
do
expect
(
rendered
).
to
have_content
'running'
end
it
'has link to external status page'
do
expect
(
rendered
).
to
have_link
'running'
,
href:
'http://gitlab.com'
end
end
context
'status do not have external target url'
do
let
(
:resource
)
do
create
(
:generic_commit_status
,
status: :canceled
)
end
it
'contains valid commit status text'
do
expect
(
rendered
).
to
have_content
'canceled'
end
it
'has link to external status page'
do
expect
(
rendered
).
not_to
have_link
'canceled'
end
end
end
def
render_status
render
'ci/status/badge'
,
status:
resource
.
detailed_status
(
user
)
end
def
user_with_role
(
role
)
project
.
team
<<
[
user
,
role
]
yield
if
block_given?
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