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
Boxiang Sun
gitlab-ce
Commits
b646adef
Commit
b646adef
authored
Aug 12, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose coverage report badge in pipeline settings
parent
b6ca47f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
39 deletions
+67
-39
app/controllers/projects/pipelines_settings_controller.rb
app/controllers/projects/pipelines_settings_controller.rb
+7
-1
app/views/projects/pipelines_settings/show.html.haml
app/views/projects/pipelines_settings/show.html.haml
+28
-24
spec/features/projects/badges/list_spec.rb
spec/features/projects/badges/list_spec.rb
+32
-14
No files found.
app/controllers/projects/pipelines_settings_controller.rb
View file @
b646adef
...
@@ -3,7 +3,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
...
@@ -3,7 +3,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
def
show
def
show
@ref
=
params
[
:ref
]
||
@project
.
default_branch
||
'master'
@ref
=
params
[
:ref
]
||
@project
.
default_branch
||
'master'
@build_badge
=
Gitlab
::
Badge
::
Build
::
Status
.
new
(
@project
,
@ref
).
metadata
@badges
=
[
Gitlab
::
Badge
::
Build
::
Status
,
Gitlab
::
Badge
::
Coverage
::
Report
]
@badges
.
map!
do
|
badge
|
badge
.
new
(
@project
,
@ref
).
metadata
end
end
end
def
update
def
update
...
...
app/views/projects/pipelines_settings/show.html.haml
View file @
b646adef
...
@@ -77,27 +77,31 @@
...
@@ -77,27 +77,31 @@
%hr
%hr
.row.prepend-top-default
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
-
@badges
.
each
do
|
badge
|
%h4
.prepend-top-0
.row
{
class:
badge
.
title
.
gsub
(
' '
,
'-'
)
}
Builds Badge
.col-lg-3.profile-settings-sidebar
.col-lg-9
%h4
.prepend-top-0
.prepend-top-10
=
badge
.
title
.
capitalize
.panel.panel-default
.col-lg-9
.panel-heading
.prepend-top-10
%b
Builds badge
·
.panel.panel-default
=
@build_badge
.
to_html
.panel-heading
.pull-right
%b
=
render
'shared/ref_switcher'
,
destination:
'badges'
,
align_right:
true
=
badge
.
title
.
capitalize
.panel-body
·
.row
=
badge
.
to_html
.col-md-2.text-center
.pull-right
Markdown
=
render
'shared/ref_switcher'
,
destination:
'badges'
,
align_right:
true
.col-md-10.code.js-syntax-highlight
.panel-body
=
highlight
(
'.md'
,
@build_badge
.
to_markdown
)
.row
.row
.col-md-2.text-center
%hr
Markdown
.row
.col-md-10.code.js-syntax-highlight
.col-md-2.text-center
=
highlight
(
'.md'
,
badge
.
to_markdown
)
HTML
.row
.col-md-10.code.js-syntax-highlight
%hr
=
highlight
(
'.html'
,
@build_badge
.
to_html
)
.row
.col-md-2.text-center
HTML
.col-md-10.code.js-syntax-highlight
=
highlight
(
'.html'
,
badge
.
to_html
)
spec/features/projects/badges/list_spec.rb
View file @
b646adef
...
@@ -9,25 +9,43 @@ feature 'list of badges' do
...
@@ -9,25 +9,43 @@ feature 'list of badges' do
visit
namespace_project_pipelines_settings_path
(
project
.
namespace
,
project
)
visit
namespace_project_pipelines_settings_path
(
project
.
namespace
,
project
)
end
end
scenario
'user displays list of badges'
do
scenario
'user wants to see build status badge'
do
expect
(
page
).
to
have_content
'build status'
page
.
within
(
'.build-status'
)
do
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'build status'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_css
(
'.highlight'
,
count:
2
)
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_xpath
(
"//img[@alt='build status']"
)
expect
(
page
).
to
have_css
(
'.highlight'
,
count:
2
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='build status']"
)
page
.
within
(
'.highlight'
,
match: :first
)
do
expect
(
page
).
to
have_content
'badges/master/build.svg'
page
.
within
(
'.highlight'
,
match: :first
)
do
expect
(
page
).
to
have_content
'badges/master/build.svg'
end
end
end
end
end
scenario
'user changes current ref on badges list page'
,
js:
true
do
scenario
'user wants to see coverage report badge'
do
first
(
'.js-project-refs-dropdown'
).
click
page
.
within
(
'.coverage-report'
)
do
expect
(
page
).
to
have_content
'coverage report'
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_css
(
'.highlight'
,
count:
2
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='coverage report']"
)
page
.
within
'.project-refs-form'
do
page
.
within
(
'.highlight'
,
match: :first
)
do
click_link
'improve/awesome'
expect
(
page
).
to
have_content
'badges/master/coverage.svg'
end
end
end
end
scenario
'user changes current ref of build status badge'
,
js:
true
do
page
.
within
(
'.build-status'
)
do
first
(
'.js-project-refs-dropdown'
).
click
expect
(
page
).
to
have_content
'badges/improve/awesome/build.svg'
page
.
within
'.project-refs-form'
do
click_link
'improve/awesome'
end
expect
(
page
).
to
have_content
'badges/improve/awesome/build.svg'
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