|
|
|
@ -62,10 +62,10 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
|
|
|
|
|
|
|
|
shared_examples 'sets pinned posts' do |
|
|
|
shared_examples 'sets pinned posts' do |
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/known').to_return(status: 200, body: Oj.dump(status_json_pinned_known)) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/known').to_return(status: 200, body: Oj.dump(status_json_pinned_known), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_inlined)) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_inlined), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-unreachable').to_return(status: 404) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-unreachable').to_return(status: 404) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
|
|
|
|
|
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
end |
|
|
|
end |
|
|
|
@ -82,7 +82,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
describe '#call' do |
|
|
|
describe '#call' do |
|
|
|
context 'when the endpoint is a Collection' do |
|
|
|
context 'when the endpoint is a Collection' do |
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload)) |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
@ -99,7 +99,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload)) |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
@ -108,7 +108,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
|
|
|
let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload)) |
|
|
|
stub_request(:get, actor.featured_collection_url).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
it_behaves_like 'sets pinned posts' |
|
|
|
@ -144,7 +144,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do |
|
|
|
let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
|
|
|
let(:items) { 'https://example.com/account/pinned/unknown-reachable' } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable)) |
|
|
|
stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) |
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
subject.call(actor, note: true, hashtag: false) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|