like_spec.rb 743 B

1234567891011121314151617181920212223242526272829
  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::Activity::Like do
  3. let(:sender) { Fabricate(:account) }
  4. let(:recipient) { Fabricate(:account) }
  5. let(:status) { Fabricate(:status, account: recipient) }
  6. let(:json) do
  7. {
  8. '@context': 'https://www.w3.org/ns/activitystreams',
  9. id: 'foo',
  10. type: 'Like',
  11. actor: ActivityPub::TagManager.instance.uri_for(sender),
  12. object: ActivityPub::TagManager.instance.uri_for(status),
  13. }.with_indifferent_access
  14. end
  15. describe '#perform' do
  16. subject { described_class.new(json, sender) }
  17. before do
  18. subject.perform
  19. end
  20. it 'creates a favourite from sender to status' do
  21. expect(sender.favourited?(status)).to be true
  22. end
  23. end
  24. end