From d4ed5b2e0c7fc94309499a0a268c543a82e00e9b Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 2 Dec 2016 12:38:07 +0100 Subject: Add abstract base class for core CI status --- lib/gitlab/ci/status/core/base.rb | 41 ++++++++++++++++++++++++++ lib/gitlab/ci/status/core/success.rb | 2 +- spec/lib/gitlab/ci/status/core/success_spec.rb | 2 ++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 lib/gitlab/ci/status/core/base.rb 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 -- cgit v1.2.1