mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 04:36:11 +10:00
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
(cherry picked from commit dc2d0051dc)
This commit is contained in:
committed by
Robert Speicher
parent
04c2c88b67
commit
ce8db128a9
@@ -8,6 +8,7 @@ v 8.9.4
|
||||
- Fixes middle click and double request when navigating through the file browser. !4891
|
||||
- Fixed URL on label button when filtering. !4897
|
||||
- Fixed commit avatar alignment. !4933
|
||||
- Do not show build retry link when build is active. !4967
|
||||
|
||||
v 8.9.3
|
||||
- Fix encrypted data backwards compatibility after upgrading attr_encrypted gem. !4963
|
||||
|
||||
@@ -90,7 +90,7 @@ module Ci
|
||||
end
|
||||
|
||||
def retryable?
|
||||
project.builds_enabled? && commands.present?
|
||||
project.builds_enabled? && commands.present? && complete?
|
||||
end
|
||||
|
||||
def retried?
|
||||
|
||||
@@ -669,4 +669,22 @@ describe Ci::Build, models: true do
|
||||
expect(build.commit).to eq project.commit
|
||||
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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user