The code powering m.abunchtell.com https://m.abunchtell.com
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

108 Zeilen
2.6 KiB

  1. require 'rails_helper'
  2. RSpec.describe ActivityPub::Activity::Undo do
  3. let(:sender) { Fabricate(:account, domain: 'example.com') }
  4. let(:json) do
  5. {
  6. '@context': 'https://www.w3.org/ns/activitystreams',
  7. id: 'foo',
  8. type: 'Undo',
  9. actor: ActivityPub::TagManager.instance.uri_for(sender),
  10. object: object_json,
  11. }.with_indifferent_access
  12. end
  13. subject { described_class.new(json, sender) }
  14. describe '#perform' do
  15. context 'with Announce' do
  16. let(:status) { Fabricate(:status) }
  17. let(:object_json) do
  18. {
  19. id: 'bar',
  20. type: 'Announce',
  21. actor: ActivityPub::TagManager.instance.uri_for(sender),
  22. object: ActivityPub::TagManager.instance.uri_for(status),
  23. }
  24. end
  25. before do
  26. Fabricate(:status, reblog: status, account: sender, uri: 'bar')
  27. end
  28. it 'deletes the reblog' do
  29. subject.perform
  30. expect(sender.reblogged?(status)).to be false
  31. end
  32. end
  33. context 'with Block' do
  34. let(:recipient) { Fabricate(:account) }
  35. let(:object_json) do
  36. {
  37. id: 'bar',
  38. type: 'Block',
  39. actor: ActivityPub::TagManager.instance.uri_for(sender),
  40. object: ActivityPub::TagManager.instance.uri_for(recipient),
  41. }
  42. end
  43. before do
  44. sender.block!(recipient)
  45. end
  46. it 'deletes block from sender to recipient' do
  47. subject.perform
  48. expect(sender.blocking?(recipient)).to be false
  49. end
  50. end
  51. context 'with Follow' do
  52. let(:recipient) { Fabricate(:account) }
  53. let(:object_json) do
  54. {
  55. id: 'bar',
  56. type: 'Follow',
  57. actor: ActivityPub::TagManager.instance.uri_for(sender),
  58. object: ActivityPub::TagManager.instance.uri_for(recipient),
  59. }
  60. end
  61. before do
  62. sender.follow!(recipient)
  63. end
  64. it 'deletes follow from sender to recipient' do
  65. subject.perform
  66. expect(sender.following?(recipient)).to be false
  67. end
  68. end
  69. context 'with Like' do
  70. let(:status) { Fabricate(:status) }
  71. let(:object_json) do
  72. {
  73. id: 'bar',
  74. type: 'Like',
  75. actor: ActivityPub::TagManager.instance.uri_for(sender),
  76. object: ActivityPub::TagManager.instance.uri_for(status),
  77. }
  78. end
  79. before do
  80. Fabricate(:favourite, account: sender, status: status)
  81. end
  82. it 'deletes favourite from sender to status' do
  83. subject.perform
  84. expect(sender.favourited?(status)).to be false
  85. end
  86. end
  87. end
  88. end