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.

32 lines
825 B

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