From 84735186a8ae73a722715f286653ccd71e7e48e8 Mon Sep 17 00:00:00 2001
From: Alex Braha Stoll <alexbrahastoll@gmail.com>
Date: Mon, 26 Dec 2016 23:51:34 -0200
Subject: [PATCH] Add WikiPage#to_partial_path

---
 app/models/wiki_page.rb       | 6 ++++++
 spec/models/wiki_page_spec.rb | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 63e5aa0e519..96d03d510ff 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -207,6 +207,12 @@ class WikiPage
     end
   end
 
+  # Relative path to the partial to be used when rendering collections
+  # of this object.
+  def to_partial_path
+    'projects/wikis/wiki_page'
+  end
+
   private
 
   def set_attributes
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 9eb94cb028d..11efd0415d9 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -322,6 +322,14 @@ describe WikiPage, models: true do
     end
   end
 
+  describe '#to_partial_path' do
+    it 'returns the relative path to the partial to be used' do
+      page = build(:wiki_page)
+
+      expect(page.to_partial_path).to eq('projects/wikis/wiki_page')
+    end
+  end
+
   private
 
   def remove_temp_repo(path)
-- 
GitLab