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.

35 lines
941 B

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