闭社主体 forked from https://github.com/tootsuite/mastodon
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.

38 lines
994 B

  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::Activity::Accept do
  3. let(:sender) { Fabricate(:account) }
  4. let(:recipient) { Fabricate(:account) }
  5. let(:json) do
  6. {
  7. '@context': 'https://www.w3.org/ns/activitystreams',
  8. id: 'foo',
  9. type: 'Accept',
  10. actor: ActivityPub::TagManager.instance.uri_for(sender),
  11. object: {
  12. id: 'bar',
  13. type: 'Follow',
  14. actor: ActivityPub::TagManager.instance.uri_for(recipient),
  15. object: ActivityPub::TagManager.instance.uri_for(sender),
  16. },
  17. }.with_indifferent_access
  18. end
  19. describe '#perform' do
  20. subject { described_class.new(json, sender) }
  21. before do
  22. Fabricate(:follow_request, account: recipient, target_account: sender)
  23. subject.perform
  24. end
  25. it 'creates a follow relationship' do
  26. expect(recipient.following?(sender)).to be true
  27. end
  28. it 'removes the follow request' do
  29. expect(recipient.requested?(sender)).to be false
  30. end
  31. end
  32. end