summaryrefslogtreecommitdiff
path: root/spec/models/ci
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 19:19:32 +0200
commitd983c5bd4671d989edf3741d0db0a54dcef9c3b6 (patch)
treeccd22f61b266ef0e0d012368ca8d763ec070ffbc /spec/models/ci
parent4c29c25497c9a20a5d1f57cd287123cd41edad96 (diff)
downloadgitlab-ce-d983c5bd4671d989edf3741d0db0a54dcef9c3b6.tar.gz
Verify the pipeline status after executing events on builds
Diffstat (limited to 'spec/models/ci')
-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 fdb579ab45c..9a9720cfbfc 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -254,4 +254,49 @@ describe Ci::Pipeline, models: true do
end
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
end