Make pages inherit their sidebar/header/footer from parent directories regardless of the current 'page_file_dir' of the wiki. refs #413 (https://github.com/github/gollum/issues/413)

This commit is contained in:
Darren Oakley
2012-07-09 12:10:41 +01:00
parent 19325930a2
commit 50e494e8e9
4 changed files with 48 additions and 9 deletions
+33
View File
@@ -195,3 +195,36 @@ context "Page" do
assert_equal "/foo", Gollum::BlobEntry.normalize_dir("/foo")
end
end
context "within a sub-directory" do
setup do
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"), { :page_file_dir => 'Rivendell' })
end
test "get existing page" do
page = @wiki.page('Elrond')
assert_equal Gollum::Page, page.class
assert page.raw_data =~ /^# Elrond\n\nElrond/
assert_equal 'Rivendell/Elrond.md', page.path
assert_equal :markdown, page.format
assert_equal @wiki.repo.commits.first.id, page.version.id
end
test "should not get page from parent dir" do
page = @wiki.page('Bilbo Baggins')
assert_equal nil, page
end
test "should inherit header/footer/sidebar pages from parent directories" do
page = @wiki.page('Elrond')
assert_equal Gollum::Page, page.sidebar.class
assert_equal Gollum::Page, page.header.class
assert_equal Gollum::Page, page.footer.class
assert page.sidebar.raw_data =~ /^Lord of the Rings/
assert page.header.raw_data =~ /^Hobbits/
assert page.footer.raw_data =~ /^Lord of the Rings/
end
end