summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-08 11:44:36 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-08 11:54:46 +0100
commit82327ea7c68faf4bb3231c0418f277fde876ec59 (patch)
tree0663be8f2d3a800f7d840d18bf1867a40c53040c
parentc83be391ee03a9fb2c7d6aca552f4f230703fb30 (diff)
downloadgitlab-ce-82327ea7c68faf4bb3231c0418f277fde876ec59.tar.gz
Add specs for an extended blocked pipeline statusfeature/gb/verbosify-blocked-pipeline-status
-rw-r--r--spec/factories/ci/pipelines.rb8
-rw-r--r--spec/lib/gitlab/ci/status/pipeline/blocked_spec.rb42
2 files changed, 50 insertions, 0 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index 77404f46c92..b67c96bc00d 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -40,6 +40,14 @@ FactoryGirl.define do
trait :invalid do
config(rspec: nil)
end
+
+ trait :blocked do
+ status :manual
+ end
+
+ trait :success do
+ status :success
+ end
end
end
end
diff --git a/spec/lib/gitlab/ci/status/pipeline/blocked_spec.rb b/spec/lib/gitlab/ci/status/pipeline/blocked_spec.rb
new file mode 100644
index 00000000000..1a2b952d374
--- /dev/null
+++ b/spec/lib/gitlab/ci/status/pipeline/blocked_spec.rb
@@ -0,0 +1,42 @@
+require 'spec_helper'
+
+describe Gitlab::Ci::Status::Pipeline::Blocked do
+ let(:pipeline) { double('pipeline') }
+
+ subject do
+ described_class.new(pipeline)
+ end
+
+ describe '#text' do
+ it 'overrides status text' do
+ expect(subject.text).to eq 'blocked'
+ end
+ end
+
+ describe '#label' do
+ it 'overrides status label' do
+ expect(subject.label).to eq 'waiting for manual action'
+ end
+ end
+
+ describe '.matches?' do
+ let(:user) { double('user') }
+ subject { described_class.matches?(pipeline, user) }
+
+ context 'when pipeline is blocked' do
+ let(:pipeline) { create(:ci_pipeline, :blocked) }
+
+ it 'is a correct match' do
+ expect(subject).to be true
+ end
+ end
+
+ context 'when pipeline is not blocked' do
+ let(:pipeline) { create(:ci_pipeline, :success) }
+
+ it 'does not match' do
+ expect(subject).to be false
+ end
+ end
+ end
+end