闭社主体 forked from https://github.com/tootsuite/mastodon
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.

37 lines
1013 B

  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. before do
  20. Setting.bootstrap_timeline_accounts = 'alice, bob'
  21. subject.call(source_account)
  22. end
  23. it 'follows found accounts from account' do
  24. expect(source_account.following?(alice)).to be true
  25. expect(source_account.following?(bob)).to be true
  26. end
  27. end
  28. end
  29. end