update_account_service_spec.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe UpdateAccountService, type: :service do
  4. subject { described_class.new }
  5. describe 'switching form locked to unlocked accounts' do
  6. let(:account) { Fabricate(:account, locked: true) }
  7. let(:alice) { Fabricate(:account) }
  8. let(:bob) { Fabricate(:account) }
  9. let(:eve) { Fabricate(:account) }
  10. before do
  11. bob.touch(:silenced_at)
  12. account.mute!(eve)
  13. FollowService.new.call(alice, account)
  14. FollowService.new.call(bob, account)
  15. FollowService.new.call(eve, account)
  16. subject.call(account, { locked: false })
  17. end
  18. it 'auto-accepts pending follow requests' do
  19. expect(alice.following?(account)).to be true
  20. expect(alice.requested?(account)).to be false
  21. end
  22. it 'does not auto-accept pending follow requests from silenced users' do
  23. expect(bob.following?(account)).to be false
  24. expect(bob.requested?(account)).to be true
  25. end
  26. it 'auto-accepts pending follow requests from muted users so as to not leak mute' do
  27. expect(eve.following?(account)).to be true
  28. expect(eve.requested?(account)).to be false
  29. end
  30. end
  31. end