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
+5 -6
View File
@@ -200,12 +200,11 @@ module Gollum
#
# Returns a Gollum::Page or nil if the page could not be found.
def find(name, version)
commit = @wiki.repo.commit(version)
if page = find_page_in_tree(commit.tree, name)
page.version = commit
page
else
nil
if commit = @wiki.repo.commit(version)
if page = find_page_in_tree(commit.tree, name)
page.version = commit
page
end
end
end
+4
View File
@@ -45,6 +45,10 @@ context "Page" do
assert_nil @wiki.page('I do not exist')
end
test "no version match" do
assert_nil @wiki.page('Bilbo Baggins', 'I do not exist')
end
test "no ext match" do
assert_nil @wiki.page('Data')
end