Commit dc2d0051 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix/build-retry-button-in-view' into 'master'

Do not show build retry link when build is active

Closes #19244

See merge request !4967
parents fa3e8282 8223e280
...@@ -30,6 +30,7 @@ v 8.10.0 (unreleased) ...@@ -30,6 +30,7 @@ v 8.10.0 (unreleased)
- Add basic system information like memory and disk usage to the admin panel - Add basic system information like memory and disk usage to the admin panel
v 8.9.4 (unreleased) v 8.9.4 (unreleased)
- Do not show build retry link in build sidebar when build is not finished yet
- Fixes middle click and double request when navigating through the file browser !4891 - Fixes middle click and double request when navigating through the file browser !4891
- Add sub nav to file page view - Add sub nav to file page view
......
...@@ -90,7 +90,7 @@ module Ci ...@@ -90,7 +90,7 @@ module Ci
end end
def retryable? def retryable?
project.builds_enabled? && commands.present? project.builds_enabled? && commands.present? && complete?
end end
def retried? def retried?
......
...@@ -669,4 +669,22 @@ describe Ci::Build, models: true do ...@@ -669,4 +669,22 @@ describe Ci::Build, models: true do
expect(build.commit).to eq project.commit expect(build.commit).to eq project.commit
end end
end end
describe '#retryable?' do
context 'when build is running' do
before { build.run! }
it 'should return false' do
expect(build.retryable?).to be false
end
end
context 'when build is finished' do
before { build.success! }
it 'should return true' do
expect(build.retryable?).to be true
end
end
end
end end
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment