Post.url
This commit is contained in:
parent
6c0eeb573e
commit
46a2c60505
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue