summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-08-11 18:37:36 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-08-11 18:37:36 +0200
commit478990bb3ee0aa6939b656763a97d637189f062d (patch)
tree2731572f37b4252f4f701136d3b6b2b771ba7103 /spec
parent99928aca755f4ccf98a58445a0176b80cd16159c (diff)
downloadgitlab-ce-478990bb3ee0aa6939b656763a97d637189f062d.tar.gz
Fix pipeline status change from pending to running
Diffstat (limited to 'spec')
-rw-r--r--spec/models/ci/pipeline_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 7da044d4f16..317f4147545 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -257,6 +257,51 @@ describe Ci::Pipeline, models: true do
end
end
+ describe '#status' do
+ let!(:build) { create(:ci_build, :created, pipeline: pipeline, name: 'test') }
+
+ subject { pipeline.reload.status }
+
+ context 'on queuing' do
+ before { build.queue }
+
+ it { is_expected.to eq('pending') }
+ end
+
+ context 'on run' do
+ before do
+ build.queue
+ build.run
+ end
+
+ it { is_expected.to eq('running') }
+ end
+
+ context 'on drop' do
+ before do
+ build.drop
+ end
+
+ it { is_expected.to eq('failed') }
+ end
+
+ context 'on success' do
+ before do
+ build.success
+ end
+
+ it { is_expected.to eq('success') }
+ end
+
+ context 'on cancel' do
+ before do
+ build.cancel
+ end
+
+ it { is_expected.to eq('canceled') }
+ end
+ end
+
describe '#execute_hooks' do
let!(:hook) do
create(:project_hook, project: project, pipeline_events: enabled)