remove_spec.rb 853 B

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