diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 13:08:21 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 13:08:21 +0100 |
commit | 943b3d0e0007d2f48a64ffdef6bf0ff0fcb774f2 (patch) | |
tree | 0831b2318b42c1638fbc35fee55391f2d1cda1cd | |
parent | d4ed5b2e0c7fc94309499a0a268c543a82e00e9b (diff) | |
download | gitlab-ce-943b3d0e0007d2f48a64ffdef6bf0ff0fcb774f2.tar.gz |
Implement the rest of core CI statuses with specs
-rw-r--r-- | lib/gitlab/ci/status/core/base.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/canceled.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/created.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/failed.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/pending.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/running.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/skipped.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/success.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/canceled_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/created_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/failed_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/pending_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/running_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/skipped_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/success_spec.rb | 6 |
15 files changed, 160 insertions, 8 deletions
diff --git a/lib/gitlab/ci/status/core/base.rb b/lib/gitlab/ci/status/core/base.rb index 96d09dcbfc5..f7687c49ffd 100644 --- a/lib/gitlab/ci/status/core/base.rb +++ b/lib/gitlab/ci/status/core/base.rb @@ -16,6 +16,10 @@ module Gitlab::Ci raise NotImplementedError end + def title + "#{@subject.class.name.demodulize}: #{label}" + end + def has_details? raise NotImplementedError end diff --git a/lib/gitlab/ci/status/core/canceled.rb b/lib/gitlab/ci/status/core/canceled.rb index 3dcddd6e3ef..5e06b946a99 100644 --- a/lib/gitlab/ci/status/core/canceled.rb +++ b/lib/gitlab/ci/status/core/canceled.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Canceled + class Canceled < Core::Base + def label + 'canceled' + end + + def icon + 'icon_status_canceled' + end end end end diff --git a/lib/gitlab/ci/status/core/created.rb b/lib/gitlab/ci/status/core/created.rb index 590f14d6b57..c116f9a97f1 100644 --- a/lib/gitlab/ci/status/core/created.rb +++ b/lib/gitlab/ci/status/core/created.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Created + class Created < Core::Base + def label + 'created' + end + + def icon + 'icon_status_created' + end end end end diff --git a/lib/gitlab/ci/status/core/failed.rb b/lib/gitlab/ci/status/core/failed.rb index d5af40b53cb..467ef71e819 100644 --- a/lib/gitlab/ci/status/core/failed.rb +++ b/lib/gitlab/ci/status/core/failed.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Failed + class Failed < Core::Base + def label + 'failed' + end + + def icon + 'icon_status_failed' + end end end end diff --git a/lib/gitlab/ci/status/core/pending.rb b/lib/gitlab/ci/status/core/pending.rb index ef57886234e..05c9e41091b 100644 --- a/lib/gitlab/ci/status/core/pending.rb +++ b/lib/gitlab/ci/status/core/pending.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Pending + class Pending < Core::Base + def label + 'pending' + end + + def icon + 'icon_status_pending' + end end end end diff --git a/lib/gitlab/ci/status/core/running.rb b/lib/gitlab/ci/status/core/running.rb index 0b027f4dc9c..01f0c57ef5f 100644 --- a/lib/gitlab/ci/status/core/running.rb +++ b/lib/gitlab/ci/status/core/running.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Running + class Running < Core::Base + def label + 'running' + end + + def icon + 'icon_status_running' + end end end end diff --git a/lib/gitlab/ci/status/core/skipped.rb b/lib/gitlab/ci/status/core/skipped.rb index b8b07a69156..e791341b7e0 100644 --- a/lib/gitlab/ci/status/core/skipped.rb +++ b/lib/gitlab/ci/status/core/skipped.rb @@ -1,7 +1,14 @@ module Gitlab::Ci module Status module Core - class Skipped + class Skipped < Core::Base + def label + 'skipped' + end + + def icon + 'icon_status_skipped' + end end end end diff --git a/lib/gitlab/ci/status/core/success.rb b/lib/gitlab/ci/status/core/success.rb index e32a5228619..bcfe7e63a6c 100644 --- a/lib/gitlab/ci/status/core/success.rb +++ b/lib/gitlab/ci/status/core/success.rb @@ -7,7 +7,7 @@ module Gitlab::Ci end def icon - 'success' + 'icon_status_success' end end end diff --git a/spec/lib/gitlab/ci/status/core/canceled_spec.rb b/spec/lib/gitlab/ci/status/core/canceled_spec.rb new file mode 100644 index 00000000000..d03b7a18aa0 --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/canceled_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Canceled do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'canceled' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_canceled' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: canceled' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/created_spec.rb b/spec/lib/gitlab/ci/status/core/created_spec.rb new file mode 100644 index 00000000000..5a6d7523e83 --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/created_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Created do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'created' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_created' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: created' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/failed_spec.rb b/spec/lib/gitlab/ci/status/core/failed_spec.rb new file mode 100644 index 00000000000..0b7e03f1684 --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/failed_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Failed do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'failed' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_failed' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: failed' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/pending_spec.rb b/spec/lib/gitlab/ci/status/core/pending_spec.rb new file mode 100644 index 00000000000..95f2255e66d --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/pending_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Pending do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'pending' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_pending' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: pending' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/running_spec.rb b/spec/lib/gitlab/ci/status/core/running_spec.rb new file mode 100644 index 00000000000..648de678618 --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/running_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Running do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'running' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_running' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: running' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/skipped_spec.rb b/spec/lib/gitlab/ci/status/core/skipped_spec.rb new file mode 100644 index 00000000000..dc2b56a1e34 --- /dev/null +++ b/spec/lib/gitlab/ci/status/core/skipped_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Gitlab::Ci::Status::Core::Skipped do + subject { described_class.new(double('subject')) } + + describe '#label' do + it { expect(subject.label).to eq 'skipped' } + end + + describe '#icon' do + it { expect(subject.icon).to eq 'icon_status_skipped' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: skipped' } + end +end diff --git a/spec/lib/gitlab/ci/status/core/success_spec.rb b/spec/lib/gitlab/ci/status/core/success_spec.rb index 93a656a46cd..fc67e58adb5 100644 --- a/spec/lib/gitlab/ci/status/core/success_spec.rb +++ b/spec/lib/gitlab/ci/status/core/success_spec.rb @@ -8,6 +8,10 @@ describe Gitlab::Ci::Status::Core::Success do end describe '#icon' do - it { expect(subject.icon).to eq 'success' } + it { expect(subject.icon).to eq 'icon_status_success' } + end + + describe '#title' do + it { expect(subject.title).to eq 'Double: passed' } end end |