From 37fe32f291d6a664bf61308c01428a3c7e0e7841 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Sun, 17 Nov 2019 17:02:48 -0500 Subject: [PATCH] Title should not be truncated content --- lib/micropub/post.rb | 4 ++-- test/lib/micropub/models/post_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/micropub/post.rb b/lib/micropub/post.rb index 65cc74f..90ad3ae 100644 --- a/lib/micropub/post.rb +++ b/lib/micropub/post.rb @@ -10,7 +10,7 @@ module Micropub end def id - title. + (title || truncated_content). downcase. gsub(/[^a-z]+/, " "). strip. @@ -18,7 +18,7 @@ module Micropub end def title - params["title"] || truncated_content + params["title"] end def path diff --git a/test/lib/micropub/models/post_test.rb b/test/lib/micropub/models/post_test.rb index b7281e8..39e57f8 100644 --- a/test/lib/micropub/models/post_test.rb +++ b/test/lib/micropub/models/post_test.rb @@ -39,10 +39,10 @@ describe Micropub::Post do _(post.title).must_equal "My great post" 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.title).must_equal "My money's in that office, right?" + assert_nil post.title end end