mastodon/spec/services/report_service_spec.rb
Eugen Rochko cb5b5cb5f7
Slightly reduce RAM usage (#7301)
* 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
2018-05-02 18:58:48 +02:00

26 lines
861 B
Ruby

require 'rails_helper'
RSpec.describe ReportService, type: :service do
subject { described_class.new }
let(:source_account) { Fabricate(:account) }
context 'for a remote account' do
let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
before do
stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
end
it 'sends ActivityPub payload when forward is true' do
subject.call(source_account, remote_account, forward: true)
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made
end
it 'does not send anything when forward is false' do
subject.call(source_account, remote_account, forward: false)
expect(a_request(:post, 'http://example.com/inbox')).to_not have_been_made
end
end
end