Refactor micropub specific things out to a slice
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
RSpec.describe Adamantium::MicropubRequestParser do
|
||||
RSpec.describe Micropub::RequestParser do
|
||||
subject { described_class.new }
|
||||
|
||||
context "json request" do
|
||||
@@ -19,7 +19,7 @@ RSpec.describe Adamantium::MicropubRequestParser do
|
||||
it "parses the params in to the expected shape" do
|
||||
Timecop.freeze do
|
||||
result = subject.call(params: params)
|
||||
expect(result).to be_a Adamantium::Entities::PostRequest
|
||||
expect(result).to be_a Micropub::Entities::PostRequest
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -38,7 +38,7 @@ RSpec.describe Adamantium::MicropubRequestParser do
|
||||
it "parses the params in to the expected shape" do
|
||||
Timecop.freeze do
|
||||
result = subject.call(params: params)
|
||||
expect(result).to be_a Adamantium::Entities::PostRequest
|
||||
expect(result).to be_a Micropub::Entities::PostRequest
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -140,7 +140,7 @@ RSpec.describe Adamantium::MicropubRequestParser do
|
||||
it "parses the request" do
|
||||
Timecop.freeze do
|
||||
result = subject.call(params: params)
|
||||
expect(result).to be_a Adamantium::Entities::CheckinRequest
|
||||
expect(result).to be_a Micropub::Entities::CheckinRequest
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -3,7 +3,7 @@
|
||||
require "dry/monads"
|
||||
require "base64"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Media::Upload do
|
||||
RSpec.describe Micropub::Commands::Media::Upload do
|
||||
subject { described_class.new }
|
||||
|
||||
it "saves a file and returns its URL" do
|
||||
|
@@ -1,11 +1,11 @@
|
||||
require "spec_helper"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Posts::AddSyndicationSource, :db do
|
||||
RSpec.describe Micropub::Commands::Posts::AddSyndicationSource, :db do
|
||||
subject { described_class.new }
|
||||
|
||||
describe "setting a syndication source" do
|
||||
let(:post) { Test::Factory[:post] }
|
||||
let(:repo) { Adamantium::Container["repos.post_repo"] }
|
||||
let(:repo) { Micropub::Container["repos.post_repo"] }
|
||||
|
||||
context "when no sources exist" do
|
||||
it "sets a new source" do
|
||||
|
@@ -1,7 +1,7 @@
|
||||
require "spec_helper"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Posts::Delete, :db do
|
||||
let(:post_repo) { spy(Adamantium::Repos::PostRepo) }
|
||||
RSpec.describe Micropub::Commands::Posts::Delete, :db do
|
||||
let(:post_repo) { spy(Micropub::Repos::PostRepo) }
|
||||
let(:subject) { described_class.new(post_repo: post_repo) }
|
||||
|
||||
it "deletes a post" do
|
||||
|
@@ -1,14 +1,14 @@
|
||||
require "spec_helper"
|
||||
require "dry/monads"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Posts::Syndicate do
|
||||
RSpec.describe Micropub::Commands::Posts::Syndicate do
|
||||
include Dry::Monads[:result]
|
||||
|
||||
let(:settings) { double("settings", mastodon_server: "https://mastodon.example/@tester", blue_sky_url: "https://bluesky.app") }
|
||||
let(:mastodon_client) { double("Adamantium::Client::Mastodon") }
|
||||
let(:mastodon_syndicator) { Adamantium::Syndication::Mastodon.new(mastodon_client: mastodon_client) }
|
||||
let(:post) { {url: "example.com", syndicate_to: ["https://mastodon.example", "https://pinboard.in"], category: []} }
|
||||
let(:add_post_syndication_source) { spy(Adamantium::Commands::Posts::AddSyndicationSource) }
|
||||
let(:add_post_syndication_source) { spy(Micropub::Commands::Posts::AddSyndicationSource) }
|
||||
|
||||
subject {
|
||||
described_class.new(mastodon: mastodon_syndicator,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
require "spec_helper"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Posts::Undelete, :db do
|
||||
let(:post_repo) { spy(Adamantium::Repos::PostRepo) }
|
||||
RSpec.describe Micropub::Commands::Posts::Undelete, :db do
|
||||
let(:post_repo) { spy(Micropub::Repos::PostRepo) }
|
||||
let(:subject) { described_class.new(post_repo: post_repo) }
|
||||
|
||||
it "deletes a post" do
|
||||
|
@@ -1,6 +1,6 @@
|
||||
require "spec_helper"
|
||||
|
||||
RSpec.describe Adamantium::Commands::Posts::Update, :db do
|
||||
RSpec.describe Micropub::Commands::Posts::Update, :db do
|
||||
# Adding: add a property that didn't previously exist
|
||||
# If there are any existing values for this property, they are not changed, the new values are added.
|
||||
# If the property does not exist already, it is created.
|
||||
@@ -10,7 +10,7 @@ RSpec.describe Adamantium::Commands::Posts::Update, :db do
|
||||
|
||||
describe "add" do
|
||||
let(:post) { Test::Factory[:post] }
|
||||
let(:repo) { Adamantium::Container["repos.post_repo"] }
|
||||
let(:repo) { Micropub::Container["repos.post_repo"] }
|
||||
|
||||
let(:params) {
|
||||
{
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Adamantium::Commands::Posts::Update, :db do
|
||||
# Replacing: Replace all values of the property. If the property does not exist already, it is created.
|
||||
describe "replace" do
|
||||
let(:post) { Test::Factory[:post] }
|
||||
let(:repo) { Adamantium::Container["repos.post_repo"] }
|
||||
let(:repo) { Micropub::Container["repos.post_repo"] }
|
||||
|
||||
let(:params) {
|
||||
{
|
||||
@@ -62,7 +62,7 @@ RSpec.describe Adamantium::Commands::Posts::Update, :db do
|
||||
describe "remove" do
|
||||
let(:post1) { Test::Factory[:post] }
|
||||
let(:post2) { Test::Factory[:post] }
|
||||
let(:repo) { Adamantium::Container["repos.post_repo"] }
|
||||
let(:repo) { Micropub::Container["repos.post_repo"] }
|
||||
|
||||
let(:complete_params) {
|
||||
{
|
||||
|
@@ -9,7 +9,7 @@ RSpec.describe Adamantium::Syndication::Mastodon do
|
||||
|
||||
describe "syndication to mastodon" do
|
||||
let(:post) {
|
||||
Adamantium::Entities::PostRequest.new(
|
||||
Micropub::Entities::PostRequest.new(
|
||||
h: "h-type",
|
||||
action: nil,
|
||||
name: "My Post",
|
||||
|
Reference in New Issue
Block a user