make Page#data call safe

This commit is contained in:
Tom Preston-Werner
2010-04-08 16:43:29 -07:00
parent 58779490b4
commit badff21cc4
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ module Gollum
#
# Returns the String data.
def data
self.blob.data
self.blob.data rescue nil
end
# Find a page in the given Gollum repo.
+5
View File
@@ -5,6 +5,11 @@ context "Page" do
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
end
test "new page" do
page = Gollum::Page.new(@wiki)
assert_nil page.data
end
test "formatted page" do
page = @wiki.formatted_page('Bilbo Baggins')
assert_equal Gollum::Page, page.class