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.

42 lines
1.2 KiB

  1. require 'rails_helper'
  2. RSpec.describe BootstrapTimelineService, type: :service do
  3. subject { described_class.new }
  4. describe '#call' do
  5. let(:source_account) { Fabricate(:account) }
  6. context 'when setting is empty' do
  7. let!(:admin) { Fabricate(:user, admin: true) }
  8. before do
  9. Setting.bootstrap_timeline_accounts = nil
  10. subject.call(source_account)
  11. end
  12. it 'follows admin accounts from account' do
  13. expect(source_account.following?(admin.account)).to be true
  14. end
  15. end
  16. context 'when setting is set' do
  17. let!(:alice) { Fabricate(:account, username: 'alice') }
  18. let!(:bob) { Fabricate(:account, username: 'bob') }
  19. let!(:eve) { Fabricate(:account, username: 'eve', suspended: true) }
  20. before do
  21. Setting.bootstrap_timeline_accounts = 'alice, @bob, eve, unknown'
  22. subject.call(source_account)
  23. end
  24. it 'follows found accounts from account' do
  25. expect(source_account.following?(alice)).to be true
  26. expect(source_account.following?(bob)).to be true
  27. end
  28. it 'does not follow suspended account' do
  29. expect(source_account.following?(eve)).to be false
  30. end
  31. end
  32. end
  33. end