You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
861 B

  1. require 'rails_helper'
  2. RSpec.describe ReportService, type: :service do
  3. subject { described_class.new }
  4. let(:source_account) { Fabricate(:account) }
  5. context 'for a remote account' do
  6. let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
  7. before do
  8. stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
  9. end
  10. it 'sends ActivityPub payload when forward is true' do
  11. subject.call(source_account, remote_account, forward: true)
  12. expect(a_request(:post, 'http://example.com/inbox')).to have_been_made
  13. end
  14. it 'does not send anything when forward is false' do
  15. subject.call(source_account, remote_account, forward: false)
  16. expect(a_request(:post, 'http://example.com/inbox')).to_not have_been_made
  17. end
  18. end
  19. end