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.

36 lines
882 B

  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::FetchRemoteStatusService do
  3. let(:sender) { Fabricate(:account) }
  4. let(:recipient) { Fabricate(:account) }
  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(sender),
  13. }
  14. end
  15. subject { described_class.new }
  16. describe '#call' do
  17. before do
  18. subject.call(object[:id], prefetched_body: Oj.dump(object))
  19. end
  20. context 'with Note object' do
  21. let(:object) { note }
  22. it 'creates status' do
  23. status = sender.statuses.first
  24. expect(status).to_not be_nil
  25. expect(status.text).to eq 'Lorem ipsum'
  26. end
  27. end
  28. end
  29. end