Expose coverage report badge in pipeline settings
This commit is contained in:
parent
b6ca47f6d4
commit
b646adef13
|
@ -3,7 +3,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
|
|||
|
||||
def show
|
||||
@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
|
||||
|
||||
def update
|
||||
|
|
|
@ -77,27 +77,31 @@
|
|||
%hr
|
||||
|
||||
.row.prepend-top-default
|
||||
.col-lg-3.profile-settings-sidebar
|
||||
%h4.prepend-top-0
|
||||
Builds Badge
|
||||
.col-lg-9
|
||||
.prepend-top-10
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%b Builds badge ·
|
||||
= @build_badge.to_html
|
||||
.pull-right
|
||||
= render 'shared/ref_switcher', destination: 'badges', align_right: true
|
||||
.panel-body
|
||||
.row
|
||||
.col-md-2.text-center
|
||||
Markdown
|
||||
.col-md-10.code.js-syntax-highlight
|
||||
= highlight('.md', @build_badge.to_markdown)
|
||||
.row
|
||||
%hr
|
||||
.row
|
||||
.col-md-2.text-center
|
||||
HTML
|
||||
.col-md-10.code.js-syntax-highlight
|
||||
= highlight('.html', @build_badge.to_html)
|
||||
- @badges.each do |badge|
|
||||
.row{ class: badge.title.gsub(' ', '-') }
|
||||
.col-lg-3.profile-settings-sidebar
|
||||
%h4.prepend-top-0
|
||||
= badge.title.capitalize
|
||||
.col-lg-9
|
||||
.prepend-top-10
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%b
|
||||
= badge.title.capitalize
|
||||
·
|
||||
= badge.to_html
|
||||
.pull-right
|
||||
= render 'shared/ref_switcher', destination: 'badges', align_right: true
|
||||
.panel-body
|
||||
.row
|
||||
.col-md-2.text-center
|
||||
Markdown
|
||||
.col-md-10.code.js-syntax-highlight
|
||||
= highlight('.md', badge.to_markdown)
|
||||
.row
|
||||
%hr
|
||||
.row
|
||||
.col-md-2.text-center
|
||||
HTML
|
||||
.col-md-10.code.js-syntax-highlight
|
||||
= highlight('.html', badge.to_html)
|
||||
|
|
|
@ -9,25 +9,43 @@ feature 'list of badges' do
|
|||
visit namespace_project_pipelines_settings_path(project.namespace, project)
|
||||
end
|
||||
|
||||
scenario 'user displays list of badges' do
|
||||
expect(page).to have_content 'build status'
|
||||
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='build status']")
|
||||
scenario 'user wants to see build status badge' do
|
||||
page.within('.build-status') do
|
||||
expect(page).to have_content 'build status'
|
||||
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='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
|
||||
|
||||
scenario 'user changes current ref on badges list page', js: true do
|
||||
first('.js-project-refs-dropdown').click
|
||||
scenario 'user wants to see coverage report badge' do
|
||||
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
|
||||
click_link 'improve/awesome'
|
||||
page.within('.highlight', match: :first) do
|
||||
expect(page).to have_content 'badges/master/coverage.svg'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
expect(page).to have_content 'badges/improve/awesome/build.svg'
|
||||
scenario 'user changes current ref of build status badge', js: true do
|
||||
page.within('.build-status') do
|
||||
first('.js-project-refs-dropdown').click
|
||||
|
||||
page.within '.project-refs-form' do
|
||||
click_link 'improve/awesome'
|
||||
end
|
||||
|
||||
expect(page).to have_content 'badges/improve/awesome/build.svg'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue