Add WikiDirectory#to_partial_path

This commit is contained in:
Alex Braha Stoll 2016-12-26 23:52:26 -02:00
parent 84735186a8
commit 7bd68ae079
2 changed files with 14 additions and 0 deletions

View file

@ -10,4 +10,10 @@ class WikiDirectory
@pages = pages @pages = pages
@directories = directories @directories = directories
end 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 end

View file

@ -42,4 +42,12 @@ RSpec.describe WikiDirectory, models: true do
end end
end 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 end