logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

report_service_spec.rb (845B)


  1. require 'rails_helper'
  2. RSpec.describe ReportService 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