Fix weird virtual deployment status
This commit is contained in:
parent
380fee7494
commit
ae75fe7461
|
|
@ -723,7 +723,7 @@ module Ci
|
|||
|
||||
if success?
|
||||
return successful_deployment_status
|
||||
elsif complete? && !success?
|
||||
elsif failed?
|
||||
return :failed
|
||||
end
|
||||
|
||||
|
|
@ -740,13 +740,11 @@ module Ci
|
|||
end
|
||||
|
||||
def successful_deployment_status
|
||||
if success? && deployment&.last?
|
||||
return :last
|
||||
elsif success? && deployment.present?
|
||||
return :out_of_date
|
||||
if deployment&.last?
|
||||
:last
|
||||
else
|
||||
:out_of_date
|
||||
end
|
||||
|
||||
:creating
|
||||
end
|
||||
|
||||
def each_report(report_types)
|
||||
|
|
|
|||
|
|
@ -813,33 +813,27 @@ describe Ci::Build do
|
|||
describe '.deployment' do
|
||||
subject { build.deployment }
|
||||
|
||||
context 'when there is an old deployment record' do
|
||||
before do
|
||||
create(:deployment, deployable: build, project: project)
|
||||
context 'when there is a deployment record with created status' do
|
||||
let!(:deployment) { create(:deployment, deployable: build, project: project) }
|
||||
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a deployment record with created status' do
|
||||
let!(:deployment) { create(:deployment, deployable: build, project: project) }
|
||||
context 'when there is a deployment record with running status' do
|
||||
let!(:deployment) { create(:deployment, :running, deployable: build, project: project) }
|
||||
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a deployment record with running status' do
|
||||
let!(:deployment) { create(:deployment, :running, deployable: build, project: project) }
|
||||
context 'when there is a deployment record with success status' do
|
||||
let!(:deployment) { create(:deployment, :success, deployable: build, project: project) }
|
||||
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a deployment record with success status' do
|
||||
let!(:deployment) { create(:deployment, :success, deployable: build, project: project) }
|
||||
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
it 'returns the record' do
|
||||
is_expected.to eq(deployment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue