diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-04-10 14:33:27 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-04-11 11:52:09 +0300 |
commit | 199e31eb24ae314428c2801454f9de676a78496c (patch) | |
tree | 231d1822ef0874678bbc084ea7e306a25dd62ce5 /spec/lib | |
parent | 160ffb6870c39d467bd5efa4170007be18ccd7d2 (diff) |
Extend specs for detailed build extended statuses
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/status/build/common_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/empty_spec.rb | 31 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/factory_spec.rb | 9 |
3 files changed, 43 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/status/build/common_spec.rb b/spec/lib/gitlab/ci/status/build/common_spec.rb index 2cce7a23ea7..ca3c66f0152 100644 --- a/spec/lib/gitlab/ci/status/build/common_spec.rb +++ b/spec/lib/gitlab/ci/status/build/common_spec.rb @@ -38,4 +38,10 @@ describe Gitlab::Ci::Status::Build::Common do expect(subject.details_path).to include "jobs/#{build.id}" end end + + describe '#illustration' do + it 'provides a fallback empty state illustration' do + expect(subject.illustration).not_to be_empty + end + end end diff --git a/spec/lib/gitlab/ci/status/build/empty_spec.rb b/spec/lib/gitlab/ci/status/build/empty_spec.rb new file mode 100644 index 00000000000..379a5a9849b --- /dev/null +++ b/spec/lib/gitlab/ci/status/build/empty_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Build::Empty do + let(:build) { create(:ci_build, :running) } + let(:status) { double('core status') } + let(:user) { double('user') } + + subject { described_class.new(status) } + + describe '#illustration' do + it 'provides an empty state illustration' do + expect(subject.illustration).not_to be_empty + end + end + + describe '.matches?' do + subject { described_class.matches?(build, user) } + + context 'when a build has trace' do + let(:build) { create(:ci_build, :trace_artifact) } + + it { is_expected.to be_falsy } + end + + context 'with a build that has not been retried' do + let(:build) { create(:ci_build, :running) } + + it { is_expected.to be_truthy } + end + end +end diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 6d5b73bb01b..83d48f1bc73 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -75,7 +75,9 @@ describe Gitlab::Ci::Status::Build::Factory do it 'matches correct extended statuses' do expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable, Gitlab::Ci::Status::Build::Failed] + .to eq [Gitlab::Ci::Status::Build::Empty, + Gitlab::Ci::Status::Build::Retryable, + Gitlab::Ci::Status::Build::Failed] end it 'fabricates a failed build status' do @@ -94,7 +96,7 @@ describe Gitlab::Ci::Status::Build::Factory do end context 'when build is allowed to fail' do - let(:build) { create(:ci_build, :failed, :allowed_to_fail) } + let(:build) { create(:ci_build, :failed, :allowed_to_fail, :trace_artifact) } it 'matches correct core status' do expect(factory.core_status).to be_a Gitlab::Ci::Status::Failed @@ -160,7 +162,8 @@ describe Gitlab::Ci::Status::Build::Factory do it 'matches correct extended statuses' do expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Cancelable] + .to eq [Gitlab::Ci::Status::Build::Empty, + Gitlab::Ci::Status::Build::Cancelable] end it 'fabricates a canceable build status' do |