Fix pipeline specs after adding retry ability check
This commit is contained in:
parent
c5e7880841
commit
6f9b458303
1 changed files with 16 additions and 8 deletions
|
@ -3,8 +3,12 @@ require 'spec_helper'
|
||||||
describe Ci::Pipeline, models: true do
|
describe Ci::Pipeline, models: true do
|
||||||
include EmailHelpers
|
include EmailHelpers
|
||||||
|
|
||||||
let(:project) { FactoryGirl.create :empty_project }
|
let(:user) { create(:user) }
|
||||||
let(:pipeline) { FactoryGirl.create :ci_empty_pipeline, status: 'created', project: project }
|
let(:project) { create(:empty_project) }
|
||||||
|
|
||||||
|
let(:pipeline) do
|
||||||
|
create(:ci_empty_pipeline, status: :created, project: project)
|
||||||
|
end
|
||||||
|
|
||||||
it { is_expected.to belong_to(:project) }
|
it { is_expected.to belong_to(:project) }
|
||||||
it { is_expected.to belong_to(:user) }
|
it { is_expected.to belong_to(:user) }
|
||||||
|
@ -559,7 +563,9 @@ describe Ci::Pipeline, models: true do
|
||||||
context 'on failure and build retry' do
|
context 'on failure and build retry' do
|
||||||
before do
|
before do
|
||||||
build.drop
|
build.drop
|
||||||
Ci::Build.retry(build)
|
project.team << [user, :developer]
|
||||||
|
|
||||||
|
Ci::Build.retry(build, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
# We are changing a state: created > failed > running
|
# We are changing a state: created > failed > running
|
||||||
|
@ -571,8 +577,6 @@ describe Ci::Pipeline, models: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#detailed_status' do
|
describe '#detailed_status' do
|
||||||
let(:user) { create(:user) }
|
|
||||||
|
|
||||||
subject { pipeline.detailed_status(user) }
|
subject { pipeline.detailed_status(user) }
|
||||||
|
|
||||||
context 'when pipeline is created' do
|
context 'when pipeline is created' do
|
||||||
|
@ -771,12 +775,16 @@ describe Ci::Pipeline, models: true do
|
||||||
describe '#retry_failed' do
|
describe '#retry_failed' do
|
||||||
let(:latest_status) { pipeline.statuses.latest.pluck(:status) }
|
let(:latest_status) { pipeline.statuses.latest.pluck(:status) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
project.team << [user, :developer]
|
||||||
|
end
|
||||||
|
|
||||||
context 'when there is a failed build and failed external status' do
|
context 'when there is a failed build and failed external status' do
|
||||||
before do
|
before do
|
||||||
create(:ci_build, :failed, name: 'build', pipeline: pipeline)
|
create(:ci_build, :failed, name: 'build', pipeline: pipeline)
|
||||||
create(:generic_commit_status, :failed, name: 'jenkins', pipeline: pipeline)
|
create(:generic_commit_status, :failed, name: 'jenkins', pipeline: pipeline)
|
||||||
|
|
||||||
pipeline.retry_failed(create(:user))
|
pipeline.retry_failed(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'retries only build' do
|
it 'retries only build' do
|
||||||
|
@ -789,7 +797,7 @@ describe Ci::Pipeline, models: true do
|
||||||
create(:ci_build, :failed, name: 'build', stage_idx: 0, pipeline: pipeline)
|
create(:ci_build, :failed, name: 'build', stage_idx: 0, pipeline: pipeline)
|
||||||
create(:ci_build, :failed, name: 'jenkins', stage_idx: 1, pipeline: pipeline)
|
create(:ci_build, :failed, name: 'jenkins', stage_idx: 1, pipeline: pipeline)
|
||||||
|
|
||||||
pipeline.retry_failed(create(:user))
|
pipeline.retry_failed(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'retries both builds' do
|
it 'retries both builds' do
|
||||||
|
@ -802,7 +810,7 @@ describe Ci::Pipeline, models: true do
|
||||||
create(:ci_build, :failed, name: 'build', stage_idx: 0, pipeline: pipeline)
|
create(:ci_build, :failed, name: 'build', stage_idx: 0, pipeline: pipeline)
|
||||||
create(:ci_build, :canceled, name: 'jenkins', stage_idx: 1, pipeline: pipeline)
|
create(:ci_build, :canceled, name: 'jenkins', stage_idx: 1, pipeline: pipeline)
|
||||||
|
|
||||||
pipeline.retry_failed(create(:user))
|
pipeline.retry_failed(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'retries both builds' do
|
it 'retries both builds' do
|
||||||
|
|
Loading…
Reference in a new issue