diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 12:38:07 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-02 12:38:07 +0100 |
commit | d4ed5b2e0c7fc94309499a0a268c543a82e00e9b (patch) | |
tree | 59582e60eee89f96b43db8949b136ff5465468ee | |
parent | 5df3e8b81b4115f44b1ee56a3531dca6d912756c (diff) | |
download | gitlab-ce-d4ed5b2e0c7fc94309499a0a268c543a82e00e9b.tar.gz |
Add abstract base class for core CI status
-rw-r--r-- | lib/gitlab/ci/status/core/base.rb | 41 | ||||
-rw-r--r-- | lib/gitlab/ci/status/core/success.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/core/success_spec.rb | 2 |
3 files changed, 44 insertions, 1 deletions
diff --git a/lib/gitlab/ci/status/core/base.rb b/lib/gitlab/ci/status/core/base.rb new file mode 100644 index 00000000000..96d09dcbfc5 --- /dev/null +++ b/lib/gitlab/ci/status/core/base.rb @@ -0,0 +1,41 @@ +module Gitlab::Ci + module Status + module Core + # Base abstract class fore core status + # + class Base + def initialize(subject) + @subject = subject + end + + def icon + raise NotImplementedError + end + + def label + raise NotImplementedError + end + + def has_details? + raise NotImplementedError + end + + def details_path + raise NotImplementedError + end + + def has_action? + raise NotImplementedError + end + + def action_icon + raise NotImplementedError + end + + def action_path + raise NotImplementedError + end + end + end + end +end diff --git a/lib/gitlab/ci/status/core/success.rb b/lib/gitlab/ci/status/core/success.rb index 7bae4f612cc..e32a5228619 100644 --- a/lib/gitlab/ci/status/core/success.rb +++ b/lib/gitlab/ci/status/core/success.rb @@ -1,7 +1,7 @@ module Gitlab::Ci module Status module Core - class Success + class Success < Core::Base def label 'passed' end diff --git a/spec/lib/gitlab/ci/status/core/success_spec.rb b/spec/lib/gitlab/ci/status/core/success_spec.rb index 80587956336..93a656a46cd 100644 --- a/spec/lib/gitlab/ci/status/core/success_spec.rb +++ b/spec/lib/gitlab/ci/status/core/success_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe Gitlab::Ci::Status::Core::Success do + subject { described_class.new(double('subject')) } + describe '#label' do it { expect(subject.label).to eq 'passed' } end |