mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Title should not be truncated content
This commit is contained in:
parent
10d6626e58
commit
37fe32f291
@ -10,7 +10,7 @@ module Micropub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def id
|
def id
|
||||||
title.
|
(title || truncated_content).
|
||||||
downcase.
|
downcase.
|
||||||
gsub(/[^a-z]+/, " ").
|
gsub(/[^a-z]+/, " ").
|
||||||
strip.
|
strip.
|
||||||
@ -18,7 +18,7 @@ module Micropub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
params["title"] || truncated_content
|
params["title"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
|
|||||||
@ -39,10 +39,10 @@ describe Micropub::Post do
|
|||||||
_(post.title).must_equal "My great post"
|
_(post.title).must_equal "My great post"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the content if there's no title" do
|
it "returns nil if there's no title" do
|
||||||
post = Micropub::Post.new("content" => "My money's in that office, right?")
|
post = Micropub::Post.new("content" => "My money's in that office, right?")
|
||||||
|
|
||||||
_(post.title).must_equal "My money's in that office, right?"
|
assert_nil post.title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user