Do not show build retry link when build is active
This commit is contained in:
parent
2efee5f641
commit
94cec500c5
2 changed files with 38 additions and 1 deletions
|
@ -40,7 +40,7 @@
|
||||||
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
|
.block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) }
|
||||||
.title
|
.title
|
||||||
Build details
|
Build details
|
||||||
- if @build.retryable?
|
- if @build.retryable? && !@build.active?
|
||||||
= link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post
|
= link_to "Retry", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right', method: :post
|
||||||
- if @build.merge_request
|
- if @build.merge_request
|
||||||
%p.build-detail-row
|
%p.build-detail-row
|
||||||
|
|
37
spec/views/projects/builds/show.html.haml_spec.rb
Normal file
37
spec/views/projects/builds/show.html.haml_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'projects/builds/show' do
|
||||||
|
include Devise::TestHelpers
|
||||||
|
|
||||||
|
let(:build) { create(:ci_build) }
|
||||||
|
let(:project) { build.project }
|
||||||
|
|
||||||
|
before do
|
||||||
|
assign(:build, build)
|
||||||
|
assign(:project, project)
|
||||||
|
|
||||||
|
allow(view).to receive(:can?).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when build is running' do
|
||||||
|
before do
|
||||||
|
build.run!
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not show retry button' do
|
||||||
|
expect(rendered).not_to have_link('Retry')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when build is not running' do
|
||||||
|
before do
|
||||||
|
build.success!
|
||||||
|
render
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows retry button' do
|
||||||
|
expect(rendered).to have_link('Retry')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue