diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-12 17:08:36 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-12 17:08:36 +0200 |
commit | 47f007d63b26fb1df8f8bf813e645141c0f30fe2 (patch) | |
tree | 2302167086312e7ccf1d818134bc40e4b6da161b /spec | |
parent | a391652fe60930e2139ecfacb175da6aa0f3b1e9 (diff) | |
parent | 283b2c0b15bbd39136f601f595157033850dd5a8 (diff) | |
download | gitlab-ce-47f007d63b26fb1df8f8bf813e645141c0f30fe2.tar.gz |
Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slack
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/build_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 23 |
2 files changed, 23 insertions, 6 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 3d66ccf3f28..79f872b2624 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -887,8 +887,10 @@ describe Ci::Build, models: true do is_expected.to eq(build) end - context 'for success build' do - before { build.queue } + context 'for successful build' do + before do + build.update(status: 'success') + end it 'creates a new build' do is_expected.to be_pending diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index a3f9934971a..19f1aacaabc 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -145,7 +145,7 @@ describe Ci::Pipeline, models: true do expect(pipeline.reload.started_at).not_to be_nil end - it 'do not update on transitioning to success' do + it 'does not update on transitioning to success' do build.success expect(pipeline.reload.started_at).to be_nil @@ -159,7 +159,7 @@ describe Ci::Pipeline, models: true do expect(pipeline.reload.finished_at).not_to be_nil end - it 'do not update on transitioning to running' do + it 'does not update on transitioning to running' do build.run expect(pipeline.reload.finished_at).to be_nil @@ -259,14 +259,16 @@ describe Ci::Pipeline, models: true do subject { pipeline.reload.status } context 'on queuing' do - before { build.queue } + before do + build.enqueue + end it { is_expected.to eq('pending') } end context 'on run' do before do - build.queue + build.enqueue build.run end @@ -296,6 +298,19 @@ describe Ci::Pipeline, models: true do it { is_expected.to eq('canceled') } end + + context 'on failure and build retry' do + before do + build.drop + Ci::Build.retry(build) + end + + # We are changing a state: created > failed > running + # Instead of: created > failed > pending + # Since the pipeline already run, so it should not be pending anymore + + it { is_expected.to eq('running') } + end end describe '#execute_hooks' do |