1
0

fetch_remote_status_service_spec.rb 863 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe FetchRemoteStatusService do
  4. let(:account) { Fabricate(:account, domain: 'example.org', uri: 'https://example.org/foo') }
  5. let(:prefetched_body) { nil }
  6. let(:note) do
  7. {
  8. '@context': 'https://www.w3.org/ns/activitystreams',
  9. id: 'https://example.org/@foo/1234',
  10. type: 'Note',
  11. content: 'Lorem ipsum',
  12. attributedTo: ActivityPub::TagManager.instance.uri_for(account),
  13. }
  14. end
  15. context 'when protocol is :activitypub' do
  16. subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
  17. let(:prefetched_body) { Oj.dump(note) }
  18. before do
  19. subject
  20. end
  21. it 'creates status' do
  22. status = account.statuses.first
  23. expect(status).to_not be_nil
  24. expect(status.text).to eq 'Lorem ipsum'
  25. end
  26. end
  27. end