start work on formatted_page

This commit is contained in:
Tom Preston-Werner
2010-04-08 16:20:05 -07:00
parent c8d9b351e2
commit 3ff115048d
7 changed files with 110 additions and 13 deletions
+5 -1
View File
@@ -11,7 +11,11 @@ require 'gollum'
# Make sure we're in the test dir, the tests expect that to be the current
# directory.
Dir.chdir(File.join(File.dirname(__FILE__), *%w[.]))
TEST_DIR = File.join(File.dirname(__FILE__), *%w[.])
def testpath(path)
File.join(TEST_DIR, path)
end
# test/spec/mini 3
# http://gist.github.com/25455
+8 -2
View File
@@ -2,10 +2,16 @@ require 'helper'
context "Page" do
setup do
@repo = Gollum::Repo.new("examples/lotr.git")
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
end
test "formatted page" do
page = @repo.formatted_page('Bilbo-Baggins')
page = @wiki.formatted_page('Bilbo Baggins')
assert_equal Gollum::Page, page.class
assert page.data =~ /^# Bilbo Baggins\n\nBilbo Baggins/
end
test "no page match" do
assert_nil @wiki.formatted_page('I do not exist')
end
end
+3 -3
View File
@@ -1,12 +1,12 @@
require 'helper'
context "Repo" do
context "Wiki" do
setup do
@repo = Gollum::Repo.new("examples/lotr.git")
@repo = Gollum::Wiki.new(testpath("examples/lotr.git"))
end
test "repo path" do
assert_equal "examples/lotr.git", @repo.path
assert_equal testpath("examples/lotr.git"), @repo.path
end
test "git repo" do