diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-13 13:07:34 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-13 15:11:21 +0100 |
commit | 6f9b4583035bd791d0786c6bfb90d43a5af88a8e (patch) | |
tree | 824f5e30f846e8fc438ecc6af2d744cb77dc5d1f /spec | |
parent | c5e788084152a110558eca747407129d01c34e94 (diff) | |
download | gitlab-ce-6f9b4583035bd791d0786c6bfb90d43a5af88a8e.tar.gz |
Fix pipeline specs after adding retry ability check
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 653f340ae72..199e09e2bb8 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -3,8 +3,12 @@ require 'spec_helper' describe Ci::Pipeline, models: true do include EmailHelpers - let(:project) { FactoryGirl.create :empty_project } - let(:pipeline) { FactoryGirl.create :ci_empty_pipeline, status: 'created', project: project } + let(:user) { create(:user) } + 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(:user) } @@ -559,7 +563,9 @@ describe Ci::Pipeline, models: true do context 'on failure and build retry' do before do build.drop - Ci::Build.retry(build) + project.team << [user, :developer] + + Ci::Build.retry(build, user) end # We are changing a state: created > failed > running @@ -571,8 +577,6 @@ describe Ci::Pipeline, models: true do end describe '#detailed_status' do - let(:user) { create(:user) } - subject { pipeline.detailed_status(user) } context 'when pipeline is created' do @@ -771,12 +775,16 @@ describe Ci::Pipeline, models: true do describe '#retry_failed' do 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 before do create(:ci_build, :failed, name: 'build', pipeline: pipeline) create(:generic_commit_status, :failed, name: 'jenkins', pipeline: pipeline) - pipeline.retry_failed(create(:user)) + pipeline.retry_failed(user) end 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: 'jenkins', stage_idx: 1, pipeline: pipeline) - pipeline.retry_failed(create(:user)) + pipeline.retry_failed(user) end 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, :canceled, name: 'jenkins', stage_idx: 1, pipeline: pipeline) - pipeline.retry_failed(create(:user)) + pipeline.retry_failed(user) end it 'retries both builds' do |