mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-08-21 07:44:37 +00:00
* No need to re-require sidekiq plugins, they are required via Gemfile * Add derailed_benchmarks tool, no need to require TTY gems in Gemfile * Replace ruby-oembed with FetchOEmbedService Reduce startup by 45382 allocated objects * Remove preloaded JSON-LD in favour of caching HTTP responses Reduce boot RAM by about 6 MiB * Fix tests * Fix test suite by stubbing out JSON-LD contexts
36 lines
957 B
Ruby
36 lines
957 B
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe FetchRemoteStatusService, type: :service do
|
|
let(:account) { Fabricate(:account) }
|
|
let(:prefetched_body) { nil }
|
|
let(:valid_domain) { Rails.configuration.x.local_domain }
|
|
|
|
let(:note) do
|
|
{
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
id: "https://#{valid_domain}/@foo/1234",
|
|
type: 'Note',
|
|
content: 'Lorem ipsum',
|
|
attributedTo: ActivityPub::TagManager.instance.uri_for(account),
|
|
}
|
|
end
|
|
|
|
context 'protocol is :activitypub' do
|
|
subject { described_class.new.call(note[:id], prefetched_body, protocol) }
|
|
let(:prefetched_body) { Oj.dump(note) }
|
|
let(:protocol) { :activitypub }
|
|
|
|
before do
|
|
account.update(uri: ActivityPub::TagManager.instance.uri_for(account))
|
|
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
|
|
end
|