like_spec.rb 774 B

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