logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

suspend_account_service_spec.rb (1161B)


  1. require 'rails_helper'
  2. RSpec.describe SuspendAccountService do
  3. describe '#call' do
  4. subject do
  5. -> { described_class.new.call(account) }
  6. end
  7. let!(:account) { Fabricate(:account) }
  8. let!(:status) { Fabricate(:status, account: account) }
  9. let!(:media_attachment) { Fabricate(:media_attachment, account: account) }
  10. let!(:notification) { Fabricate(:notification, account: account) }
  11. let!(:favourite) { Fabricate(:favourite, account: account) }
  12. let!(:active_relationship) { Fabricate(:follow, account: account) }
  13. let!(:passive_relationship) { Fabricate(:follow, target_account: account) }
  14. let!(:subscription) { Fabricate(:subscription, account: account) }
  15. it 'deletes associated records' do
  16. is_expected.to change {
  17. [
  18. account.statuses,
  19. account.media_attachments,
  20. account.stream_entries,
  21. account.notifications,
  22. account.favourites,
  23. account.active_relationships,
  24. account.passive_relationships,
  25. account.subscriptions
  26. ].map(&:count)
  27. }.from([1, 1, 1, 1, 1, 1, 1, 1]).to([0, 0, 0, 0, 0, 0, 0, 0])
  28. end
  29. end
  30. end