diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-04-04 21:00:32 +0200 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-04-04 21:00:32 +0200 |
commit | d883fe1cce01f53a3acc442e8b94ca20540e0525 (patch) | |
tree | 47d93dc076ffc7ffd9f7729beb0725bea41e4bdd /spec | |
parent | 75f8a45f6a202aa5bec00613dcd16573fc1cc46a (diff) | |
download | gitlab-ce-d883fe1cce01f53a3acc442e8b94ca20540e0525.tar.gz |
Add success CI Build empty state status
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/status/build/factory_spec.rb | 16 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/success_spec.rb | 33 |
2 files changed, 49 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index a68fed0a41c..28166d08c02 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -36,6 +36,22 @@ describe Gitlab::Ci::Status::Build::Factory do expect(status).to have_details expect(status).to have_action end + + context 'when job log gets erased' do + before do + build.trace.set(nil) + end + + it 'matches correct extended statuses' do + expect(factory.extended_statuses) + .to eq [Gitlab::Ci::Status::Build::Success, + Gitlab::Ci::Status::Build::Retryable] + end + + it 'fabricates a retryable build status' do + expect(status).to be_a Gitlab::Ci::Status::Build::Retryable + end + end end context 'when build is failed' do diff --git a/spec/lib/gitlab/ci/status/build/success_spec.rb b/spec/lib/gitlab/ci/status/build/success_spec.rb new file mode 100644 index 00000000000..730cd7aefbc --- /dev/null +++ b/spec/lib/gitlab/ci/status/build/success_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Build::Success do + let(:user) { create(:user) } + + subject do + described_class.new(double('subject')) + end + + describe '#illustration' do + it { expect(subject.illustration).to include(:image, :size, :title) } + end + + describe '.matches?' do + subject {described_class.matches?(build, user) } + + context 'when build succeeded' do + let(:build) { create(:ci_build, :success) } + + it 'is a correct match' do + expect(subject).to be true + end + end + + context 'when build did not succeed' do + let(:build) { create(:ci_build, :skipped) } + + it 'does not match' do + expect(subject).to be false + end + end + end +end |