summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Braha Stoll <alexbrahastoll@gmail.com>2016-12-26 23:52:26 -0200
committerAlex Braha Stoll <alexbrahastoll@gmail.com>2016-12-31 16:55:50 -0200
commit7bd68ae0799a982a4113de3480bef0d51ecb2f1c (patch)
tree9c50198c0802eb6256ade04e9748bdb1bc287964
parent84735186a8ae73a722715f286653ccd71e7e48e8 (diff)
downloadgitlab-ce-7bd68ae0799a982a4113de3480bef0d51ecb2f1c.tar.gz
Add WikiDirectory#to_partial_path
-rw-r--r--app/models/wiki_directory.rb6
-rw-r--r--spec/models/wiki_directory_spec.rb8
2 files changed, 14 insertions, 0 deletions
diff --git a/app/models/wiki_directory.rb b/app/models/wiki_directory.rb
index c126a4d0421..561e5a497bc 100644
--- a/app/models/wiki_directory.rb
+++ b/app/models/wiki_directory.rb
@@ -10,4 +10,10 @@ class WikiDirectory
@pages = pages
@directories = directories
end
+
+ # Relative path to the partial to be used when rendering collections
+ # of this object.
+ def to_partial_path
+ 'projects/wikis/wiki_directory'
+ end
end
diff --git a/spec/models/wiki_directory_spec.rb b/spec/models/wiki_directory_spec.rb
index 8362a285c54..fac70f8d3c7 100644
--- a/spec/models/wiki_directory_spec.rb
+++ b/spec/models/wiki_directory_spec.rb
@@ -42,4 +42,12 @@ RSpec.describe WikiDirectory, models: true do
end
end
end
+
+ describe '#to_partial_path' do
+ it 'returns the relative path to the partial to be used' do
+ directory = build(:wiki_directory)
+
+ expect(directory.to_partial_path).to eq('projects/wikis/wiki_directory')
+ end
+ end
end