remove_spec.rb 822 B

123456789101112131415161718192021222324252627282930
  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::Activity::Remove do
  3. let(:sender) { Fabricate(:account, featured_collection_url: 'https://example.com/featured') }
  4. let(:status) { Fabricate(:status, account: sender) }
  5. let(:json) do
  6. {
  7. '@context': 'https://www.w3.org/ns/activitystreams',
  8. id: 'foo',
  9. type: 'Add',
  10. actor: ActivityPub::TagManager.instance.uri_for(sender),
  11. object: ActivityPub::TagManager.instance.uri_for(status),
  12. target: sender.featured_collection_url,
  13. }.with_indifferent_access
  14. end
  15. describe '#perform' do
  16. subject { described_class.new(json, sender) }
  17. before do
  18. StatusPin.create!(account: sender, status: status)
  19. subject.perform
  20. end
  21. it 'removes a pin' do
  22. expect(sender.pinned?(status)).to be false
  23. end
  24. end
  25. end