2016-09-26 15:42:38 +01:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-05-02 17:58:48 +01:00
|
|
|
RSpec.describe FetchRemoteStatusService, type: :service do
|
2022-05-17 13:52:26 +01:00
|
|
|
let(:account) { Fabricate(:account, domain: 'example.org', uri: 'https://example.org/foo') }
|
2018-02-18 15:34:03 +00:00
|
|
|
let(:prefetched_body) { nil }
|
|
|
|
|
|
|
|
let(:note) do
|
|
|
|
{
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
2022-05-17 13:52:26 +01:00
|
|
|
id: "https://example.org/@foo/1234",
|
2018-02-18 15:34:03 +00:00
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
attributedTo: ActivityPub::TagManager.instance.uri_for(account),
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'protocol is :activitypub' do
|
2019-12-17 12:32:57 +00:00
|
|
|
subject { described_class.new.call(note[:id], prefetched_body) }
|
2018-02-18 15:34:03 +00:00
|
|
|
let(:prefetched_body) { Oj.dump(note) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates status' do
|
|
|
|
status = account.statuses.first
|
|
|
|
|
|
|
|
expect(status).to_not be_nil
|
|
|
|
expect(status.text).to eq 'Lorem ipsum'
|
|
|
|
end
|
|
|
|
end
|
2016-09-26 15:42:38 +01:00
|
|
|
end
|