diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-19 21:58:43 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-02-19 21:58:43 +0300 |
commit | aa812dbfcc693f82e1a9b16e0e894d2800938d9e (patch) | |
tree | 61a6b0abfe2ab6fc220c06c3a6a65916e5cd4e3b /spec/lib/ci | |
parent | 1817b766b2bdf03e886118bda5e1aee48b5c2413 (diff) |
Fix missing ignored? for GenericCommitStatus
Diffstat (limited to 'spec/lib/ci')
-rw-r--r-- | spec/lib/ci/status_spec.rb | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/spec/lib/ci/status_spec.rb b/spec/lib/ci/status_spec.rb index cc4199dc7b6..a2eb14f3a97 100644 --- a/spec/lib/ci/status_spec.rb +++ b/spec/lib/ci/status_spec.rb @@ -2,36 +2,40 @@ require 'spec_helper' describe Ci::Status do describe '.get_status' do - subject { described_class.get_status(builds) } + subject { described_class.get_status(statuses) } + + [:ci_build, :generic_commit_status].each do |type| + context "for #{type}" do + context 'all successful' do + let(:statuses) { Array.new(2) { create(type, status: :success) } } + it { is_expected.to eq 'success' } + end - context 'all builds successful' do - let(:builds) { Array.new(2) { create(:ci_build, :success) } } - it { is_expected.to eq 'success' } - end - - context 'at least one build failed' do - let(:builds) { [create(:ci_build, :success), create(:ci_build, :failed)] } - it { is_expected.to eq 'failed' } - end + context 'at least one failed' do + let(:statuses) { [create(type, status: :success), create(type, status: :failed)] } + it { is_expected.to eq 'failed' } + end - context 'at least one running' do - let(:builds) { [create(:ci_build, :success), create(:ci_build, :running)] } - it { is_expected.to eq 'running' } - end + context 'at least one running' do + let(:statuses) { [create(type, status: :success), create(type, status: :running)] } + it { is_expected.to eq 'running' } + end - context 'at least one pending' do - let(:builds) { [create(:ci_build, :success), create(:ci_build, :pending)] } - it { is_expected.to eq 'running' } - end + context 'at least one pending' do + let(:statuses) { [create(type, status: :success), create(type, status: :pending)] } + it { is_expected.to eq 'running' } + end - context 'build success and failed but allowed to fail' do - let(:builds) { [create(:ci_build, :success), create(:ci_build, :failed, :allowed_to_fail)] } - it { is_expected.to eq 'success' } - end + context 'success and failed but allowed to fail' do + let(:statuses) { [create(type, status: :success), create(type, status: :failed, allow_failure: true)] } + it { is_expected.to eq 'success' } + end - context 'one build failed but allowed to fail' do - let(:builds) { [create(:ci_build, :failed, :allowed_to_fail)] } - it { is_expected.to eq 'success' } + context 'one failed but allowed to fail' do + let(:statuses) { [create(type, status: :failed, allow_failure: true)] } + it { is_expected.to eq 'success' } + end + end end end end |