2023-02-22 01:55:31 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-26 16:42:38 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-03-13 09:39:26 +01:00
|
|
|
RSpec.describe FetchRemoteStatusService do
|
2022-05-17 14:52:26 +02:00
|
|
|
let(:account) { Fabricate(:account, domain: 'example.org', uri: 'https://example.org/foo') }
|
2018-02-18 16:34:03 +01:00
|
|
|
let(:prefetched_body) { nil }
|
|
|
|
|
|
|
|
let(:note) do
|
|
|
|
{
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
2023-02-18 23:38:14 +01:00
|
|
|
id: 'https://example.org/@foo/1234',
|
2018-02-18 16:34:03 +01:00
|
|
|
type: 'Note',
|
|
|
|
content: 'Lorem ipsum',
|
|
|
|
attributedTo: ActivityPub::TagManager.instance.uri_for(account),
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2023-05-04 05:49:08 +02:00
|
|
|
context 'when protocol is :activitypub' do
|
2023-02-10 22:16:37 +01:00
|
|
|
subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
|
2023-02-20 02:46:00 +01:00
|
|
|
|
2018-02-18 16:34:03 +01: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 16:42:38 +02:00
|
|
|
end
|