This commit is contained in:
Tom Preston-Werner 2008-10-19 20:18:05 -07:00
parent 6c0eeb573e
commit 46a2c60505
2 changed files with 12 additions and 1 deletions

View File

@ -22,6 +22,10 @@ module AutoBlog
self.slug = slug
self.ext = ext
end
def url
self.date.strftime("/%Y/%m/%d/") + self.slug
end
end
end

View File

@ -10,7 +10,7 @@ class TestPost < Test::Unit::TestCase
assert !Post.valid?("blah")
end
def test_site_init
def test_process
p = Post.allocate
p.process("2008-10-19-foo-bar.textile")
@ -18,4 +18,11 @@ class TestPost < Test::Unit::TestCase
assert_equal "foo-bar", p.slug
assert_equal "textile", p.ext
end
def test_url
p = Post.allocate
p.process("2008-10-19-foo-bar.textile")
assert_equal "/2008/10/19/foo-bar", p.url
end
end