update_account_service_spec.rb 1012 B

123456789101112131415161718192021222324252627282930313233343536
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe UpdateAccountService do
  4. subject { described_class.new }
  5. describe 'switching form locked to unlocked accounts', :inline_jobs 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. end
  17. it 'auto accepts pending follow requests from appropriate accounts' do
  18. subject.call(account, { locked: false })
  19. expect(alice).to be_following(account)
  20. expect(alice).to_not be_requested(account)
  21. expect(bob).to_not be_following(account)
  22. expect(bob).to be_requested(account)
  23. expect(eve).to be_following(account)
  24. expect(eve).to_not be_requested(account)
  25. end
  26. end
  27. end