mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Turns out title is passed as name (WTF?)
This commit is contained in:
parent
fc9698e745
commit
695825d230
@ -19,7 +19,7 @@ module Micropub
|
|||||||
end
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
params["title"]
|
params["name"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
|
|||||||
@ -6,7 +6,7 @@ module Micropub
|
|||||||
|
|
||||||
def params
|
def params
|
||||||
{
|
{
|
||||||
"title" => title,
|
"name" => name,
|
||||||
"content" => content,
|
"content" => content,
|
||||||
"category" => category,
|
"category" => category,
|
||||||
}.compact
|
}.compact
|
||||||
@ -16,8 +16,8 @@ module Micropub
|
|||||||
|
|
||||||
attr_accessor :data
|
attr_accessor :data
|
||||||
|
|
||||||
def title
|
def name
|
||||||
data.dig("properties", "title", 0)
|
data.dig("properties", "name", 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
def content
|
def content
|
||||||
|
|||||||
@ -5,7 +5,7 @@ require "micropub/post"
|
|||||||
describe Micropub::Post do
|
describe Micropub::Post do
|
||||||
describe "#id" do
|
describe "#id" do
|
||||||
it "parameterizes the title" do
|
it "parameterizes the title" do
|
||||||
post = Micropub::Post.new("title" => "My amazing post")
|
post = Micropub::Post.new("name" => "My amazing post")
|
||||||
|
|
||||||
_(post.id).must_equal "my-amazing-post"
|
_(post.id).must_equal "my-amazing-post"
|
||||||
end
|
end
|
||||||
@ -34,7 +34,7 @@ describe Micropub::Post do
|
|||||||
|
|
||||||
describe "#title" do
|
describe "#title" do
|
||||||
it "returns the title" do
|
it "returns the title" do
|
||||||
post = Micropub::Post.new("title" => "My great post")
|
post = Micropub::Post.new("name" => "My great post")
|
||||||
|
|
||||||
_(post.title).must_equal "My great post"
|
_(post.title).must_equal "My great post"
|
||||||
end
|
end
|
||||||
@ -208,7 +208,7 @@ describe Micropub::Post do
|
|||||||
|
|
||||||
it "returns a post formatted for hugo with a title" do
|
it "returns a post formatted for hugo with a title" do
|
||||||
post = Micropub::Post.new(
|
post = Micropub::Post.new(
|
||||||
"title" => "Welcome!",
|
"name" => "Welcome!",
|
||||||
"content" => "Hallo, Earth!",
|
"content" => "Hallo, Earth!",
|
||||||
"published" => "2019-11-12",
|
"published" => "2019-11-12",
|
||||||
"category" => ["one", "two", "three"],
|
"category" => ["one", "two", "three"],
|
||||||
@ -21,7 +21,7 @@ describe "create post" do
|
|||||||
|
|
||||||
it "creates a post with a title" do
|
it "creates a post with a title" do
|
||||||
post "/micropub/main", {
|
post "/micropub/main", {
|
||||||
title: "My money's in that office, right?",
|
name: "My money's in that office, right?",
|
||||||
content: <<~CONTENT,
|
content: <<~CONTENT,
|
||||||
If she start giving me some bullshit about it ain"t there, and we got
|
If she start giving me some bullshit about it ain"t there, and we got
|
||||||
to go someplace else and get it, I"m gonna shoot you in the head then
|
to go someplace else and get it, I"m gonna shoot you in the head then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user