mirror of
https://github.com/danbee/micropub.git
synced 2025-03-04 08:59:13 +00:00
Compare commits
No commits in common. "58a600cf7c8647e88ea9c19121c8c2d4db7e5945" and "1f1afc99e86f17fcd8a0397fbc007eb9f61f6344" have entirely different histories.
58a600cf7c
...
1f1afc99e8
@ -72,7 +72,7 @@ GEM
|
|||||||
public_suffix (4.0.1)
|
public_suffix (4.0.1)
|
||||||
puma (4.3.0)
|
puma (4.3.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
rack (2.0.8)
|
rack (2.0.7)
|
||||||
rack-protection (2.0.7)
|
rack-protection (2.0.7)
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
|
|||||||
@ -58,10 +58,6 @@ module Micropub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def photo
|
|
||||||
params["photo"]
|
|
||||||
end
|
|
||||||
|
|
||||||
def content_from_hash
|
def content_from_hash
|
||||||
if params["content"]["text"]
|
if params["content"]["text"]
|
||||||
params["content"]["text"]
|
params["content"]["text"]
|
||||||
|
|||||||
@ -1,48 +0,0 @@
|
|||||||
require "test_helper"
|
|
||||||
|
|
||||||
require "micropub/github"
|
|
||||||
|
|
||||||
describe Micropub::Github do
|
|
||||||
describe "#post!" do
|
|
||||||
it "sends the post to github" do
|
|
||||||
contents = mock("contents")
|
|
||||||
contents.expects(:create).with(
|
|
||||||
"danbee",
|
|
||||||
"danbarber.me.hugo",
|
|
||||||
"content/blog/2020-01-01-hello-world/index.md",
|
|
||||||
{
|
|
||||||
path: "content/blog/2020-01-01-hello-world/index.md",
|
|
||||||
message: "Posting: Hello, World!",
|
|
||||||
:content => <<~CONTENT,
|
|
||||||
---
|
|
||||||
date: '2020-01-01T00:00:00+00:00'
|
|
||||||
layout: micropost
|
|
||||||
categories:
|
|
||||||
- my-blog
|
|
||||||
---
|
|
||||||
|
|
||||||
Hello, World!
|
|
||||||
CONTENT
|
|
||||||
:branch => "master",
|
|
||||||
}).returns(true)
|
|
||||||
repos = mock("repos")
|
|
||||||
repos.stubs(:contents).returns(contents)
|
|
||||||
github_api = mock("Github")
|
|
||||||
github_api.stubs(:repos).returns(repos)
|
|
||||||
::Github.stubs(:new).returns(github_api)
|
|
||||||
|
|
||||||
github = Micropub::Github.new
|
|
||||||
post = Micropub::Post.new(params)
|
|
||||||
|
|
||||||
github.post!(post)
|
|
||||||
end
|
|
||||||
|
|
||||||
def params
|
|
||||||
{
|
|
||||||
"content" => "Hello, World!",
|
|
||||||
"category" => "my-blog",
|
|
||||||
"published" => DateTime.parse("2020-01-01").rfc3339,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -184,18 +184,6 @@ describe Micropub::Post do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#photo" do
|
|
||||||
it "returns the url of the photo" do
|
|
||||||
post = Micropub::Post.new(
|
|
||||||
"content" => "Hallo, Earth!",
|
|
||||||
"photo" => "http://www.example.com/example.png",
|
|
||||||
"published" => "2019-11-12",
|
|
||||||
)
|
|
||||||
|
|
||||||
_(post.photo).must_equal "http://www.example.com/example.png"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#post_content" do
|
describe "#post_content" do
|
||||||
it "returns a post formatted for hugo" do
|
it "returns a post formatted for hugo" do
|
||||||
post = Micropub::Post.new(
|
post = Micropub::Post.new(
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
require 'minitest/hooks'
|
||||||
|
|
||||||
include Rack::Test::Methods
|
include Rack::Test::Methods
|
||||||
|
MiniTest::Spec.register_spec_type(/something/, Minitest::HooksSpec)
|
||||||
|
|
||||||
def app
|
def app
|
||||||
Micropub::Webserver
|
Micropub::Webserver
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user