fetching pages from a bad version returns nil
This commit is contained in:
+2
-3
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user