fetching pages from a bad version returns nil

This commit is contained in:
rick
2010-07-23 16:36:44 -07:00
parent 9ca94a2106
commit a1db39195c
2 changed files with 9 additions and 6 deletions
+2 -3
View File
@@ -200,12 +200,11 @@ module Gollum
# #
# Returns a Gollum::Page or nil if the page could not be found. # Returns a Gollum::Page or nil if the page could not be found.
def find(name, version) def find(name, version)
commit = @wiki.repo.commit(version) if commit = @wiki.repo.commit(version)
if page = find_page_in_tree(commit.tree, name) if page = find_page_in_tree(commit.tree, name)
page.version = commit page.version = commit
page page
else end
nil
end end
end end
+4
View File
@@ -45,6 +45,10 @@ context "Page" do
assert_nil @wiki.page('I do not exist') assert_nil @wiki.page('I do not exist')
end end
test "no version match" do
assert_nil @wiki.page('Bilbo Baggins', 'I do not exist')
end
test "no ext match" do test "no ext match" do
assert_nil @wiki.page('Data') assert_nil @wiki.page('Data')
end end