This commit is contained in:
KMY 2024-02-16 22:08:45 +09:00
parent c5782a87b7
commit f4826acd57
3 changed files with 9 additions and 9 deletions

View file

@ -30,7 +30,7 @@ RSpec.describe ActivityPub::Activity::Create do
stub_request(:get, 'http://example.com/attachment.png').to_return(request_fixture('avatar.txt')) stub_request(:get, 'http://example.com/attachment.png').to_return(request_fixture('avatar.txt'))
stub_request(:get, 'http://example.com/emoji.png').to_return(body: attachment_fixture('emojo.png')) stub_request(:get, 'http://example.com/emoji.png').to_return(body: attachment_fixture('emojo.png'))
stub_request(:get, 'http://example.com/emojib.png').to_return(body: attachment_fixture('emojo.png'), headers: { 'Content-Type' => 'application/octet-stream' }) stub_request(:get, 'http://example.com/emojib.png').to_return(body: attachment_fixture('emojo.png'), headers: { 'Content-Type' => 'application/octet-stream' })
stub_request(:get, 'http://example.com/conversation').to_return(body: Oj.dump(conversation)) stub_request(:get, 'http://example.com/conversation').to_return(body: Oj.dump(conversation), headers: { 'Content-Type': 'application/activity+json' })
stub_request(:get, 'http://example.com/invalid-conversation').to_return(status: 404) stub_request(:get, 'http://example.com/invalid-conversation').to_return(status: 404)
end end
@ -1158,10 +1158,10 @@ RSpec.describe ActivityPub::Activity::Create do
end end
before do before do
stub_request(:get, 'https://foo.test').to_return(status: 200, body: Oj.dump(actor_json)) stub_request(:get, 'https://foo.test').to_return(status: 200, body: Oj.dump(actor_json), headers: { 'Content-Type': 'application/activity+json' })
stub_request(:get, 'https://foo.test/.well-known/webfinger?resource=acct:actor@foo.test').to_return(status: 200, body: Oj.dump(webfinger)) stub_request(:get, 'https://foo.test/.well-known/webfinger?resource=acct:actor@foo.test').to_return(status: 200, body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/activity+json' })
stub_request(:post, 'https://foo.test/inbox').to_return(status: 200) stub_request(:post, 'https://foo.test/inbox').to_return(status: 200)
stub_request(:get, 'https://foo.test/.well-known/nodeinfo').to_return(status: 200) stub_request(:get, 'https://foo.test/.well-known/nodeinfo').to_return(status: 200, headers: { 'Content-Type': 'application/activity+json' })
subject.perform subject.perform
end end

View file

@ -64,8 +64,8 @@ RSpec.describe ActivityPub::Activity::Like do
before do before do
stub_request(:get, 'http://example.com/emoji.png').to_return(body: attachment_fixture('emojo.png')) stub_request(:get, 'http://example.com/emoji.png').to_return(body: attachment_fixture('emojo.png'))
stub_request(:get, 'http://foo.bar/emoji2.png').to_return(body: attachment_fixture('emojo.png')) stub_request(:get, 'http://foo.bar/emoji2.png').to_return(body: attachment_fixture('emojo.png'))
stub_request(:get, 'https://example.com/aaa').to_return(status: 200, body: Oj.dump(original_emoji)) stub_request(:get, 'https://example.com/aaa').to_return(status: 200, body: Oj.dump(original_emoji), headers: { 'Content-Type': 'application/activity+json' })
stub_request(:get, 'https://example.com/invalid').to_return(status: 200, body: Oj.dump(original_invalid_emoji)) stub_request(:get, 'https://example.com/invalid').to_return(status: 200, body: Oj.dump(original_invalid_emoji), headers: { 'Content-Type': 'application/activity+json' })
end end
let(:json) do let(:json) do

View file

@ -54,7 +54,7 @@ RSpec.describe ActivityPub::FetchReferencesService, type: :service do
subject { described_class.new.call(status, collection_uri) } subject { described_class.new.call(status, collection_uri) }
before do before do
stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload)) stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' })
end end
it 'first 8 items are returned' do it 'first 8 items are returned' do
@ -83,7 +83,7 @@ RSpec.describe ActivityPub::FetchReferencesService, type: :service do
subject { described_class.new.call(status, collection_uri) } subject { described_class.new.call(status, collection_uri) }
before do before do
stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload)) stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' })
end end
it 'first 8 items are returned' do it 'first 8 items are returned' do
@ -116,7 +116,7 @@ RSpec.describe ActivityPub::FetchReferencesService, type: :service do
subject { described_class.new.call(status, collection_uri) } subject { described_class.new.call(status, collection_uri) }
before do before do
stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload)) stub_request(:get, collection_uri).to_return(status: 200, body: Oj.dump(payload), headers: { 'Content-Type': 'application/activity+json' })
end end
it 'first 8 items are returned' do it 'first 8 items are returned' do