You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

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