summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-05-15 13:03:09 -0500
committerMayra Cabrera <mcabrera@gitlab.com>2018-05-15 14:24:11 -0500
commit86ef8221778d2aff630feecfa15ba70514983dbc (patch)
treeaa760ef121c74a3c97131963f9c6c0790acf1f15
parentbdf279b151c2a530155425f352daac0576f1ec60 (diff)
downloadgitlab-ce-86ef8221778d2aff630feecfa15ba70514983dbc.tar.gz
Makes CommitStatus and GenericCommitStatus respond to presentable
methods Includes Presentable module into CommitStatus. This fixes presenter methods being called on those classes. Closes #46177
-rw-r--r--app/models/commit_status.rb1
-rw-r--r--app/presenters/commit_status_presenter.rb2
-rw-r--r--app/presenters/generic_commit_status_presenter.rb2
-rw-r--r--spec/models/commit_status_spec.rb9
4 files changed, 14 insertions, 0 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 97d89422594..a7d05722287 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -2,6 +2,7 @@ class CommitStatus < ActiveRecord::Base
include HasStatus
include Importable
include AfterCommitQueue
+ include Presentable
self.table_name = 'ci_builds'
diff --git a/app/presenters/commit_status_presenter.rb b/app/presenters/commit_status_presenter.rb
new file mode 100644
index 00000000000..028deaf235c
--- /dev/null
+++ b/app/presenters/commit_status_presenter.rb
@@ -0,0 +1,2 @@
+class CommitStatusPresenter < Ci::BuildPresenter
+end
diff --git a/app/presenters/generic_commit_status_presenter.rb b/app/presenters/generic_commit_status_presenter.rb
new file mode 100644
index 00000000000..da09df29a37
--- /dev/null
+++ b/app/presenters/generic_commit_status_presenter.rb
@@ -0,0 +1,2 @@
+class GenericCommitStatusPresenter < CommitStatusPresenter
+end
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 2ed29052dc1..eddcf616b53 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -565,4 +565,13 @@ describe CommitStatus do
it_behaves_like 'commit status enqueued'
end
end
+
+ describe '#present' do
+ let(:generic_commit_status) { create(:generic_commit_status) }
+
+ it 'returns a presenter' do
+ expect(commit_status.present).to be_a(Ci::BuildPresenter)
+ expect(generic_commit_status.present).to be_a(Ci::BuildPresenter)
+ end
+ end
end