Add a method that returns a given page name scoped to a directory.

This is to allow access to non unique pages.
This commit is contained in:
Odin Dutton and Sebastian Korfmann
2012-08-01 09:12:25 +10:00
committed by Odin Dutton
parent 8422b71204
commit be086d94b5
3 changed files with 30 additions and 2 deletions
+16
View File
@@ -94,6 +94,22 @@ context "Wiki" do
assert_match "b/_Sidebar.md", diff
assert_no_match regex, diff
end
test "gets scoped page from specified directory" do
@path = cloned_testpath('examples/lotr.git')
begin
wiki = Gollum::Wiki.new(@path)
index = wiki.repo.index
index.read_tree 'master'
index.add('Foobar/Elrond.md', 'Baz')
index.commit 'Add Foobar/Elrond.', [wiki.repo.commits.last], Grit::Actor.new('Tom Preston-Werner', 'tom@github.com')
assert_equal 'Rivendell/Elrond.md', wiki.scoped_page('Elrond', 'Rivendell').path
assert_equal 'Foobar/Elrond.md', wiki.scoped_page('Elrond', 'Foobar').path
ensure
FileUtils.rm_rf(@path)
end
end
end
context "Wiki page previewing" do