implement File#version

This commit is contained in:
Tom Preston-Werner
2010-04-11 13:09:54 -06:00
parent 2e328e6a83
commit bcd8a0d1a4
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
module Gollum module Gollum
class File class File
attr_accessor :wiki, :blob attr_accessor :wiki, :blob, :version
# Initialize a file. # Initialize a file.
# #
@@ -28,6 +28,7 @@ module Gollum
commit = self.wiki.repo.commit(version) commit = self.wiki.repo.commit(version)
if blob = commit.tree / name if blob = commit.tree / name
self.blob = blob self.blob = blob
self.version = commit
self self
else else
nil nil
+1
View File
@@ -13,5 +13,6 @@ context "File" do
test "existing file" do test "existing file" do
file = @wiki.file("Mordor/todo.txt") file = @wiki.file("Mordor/todo.txt")
assert_equal "[ ] Write section on Ents\n", file.raw_data assert_equal "[ ] Write section on Ents\n", file.raw_data
assert_equal @wiki.repo.commits.first.id, file.version.id
end end
end end