tootlab-mastodon/spec/services/bootstrap_timeline_service_spec.rb
Eugen Rochko 7d7844a47f Default follows for new users (#4871)
When a new user confirms their e-mail, bootstrap their home timeline
by automatically following a set of accounts. By default, all local
admin accounts (that are unlocked). Can be customized by new admin
setting (comma-separated usernames, local and unlocked only)
2017-09-10 09:58:38 +02:00

38 lines
997 B
Ruby

require 'rails_helper'
RSpec.describe BootstrapTimelineService do
subject { described_class.new }
describe '#call' do
let(:source_account) { Fabricate(:account) }
context 'when setting is empty' do
let!(:admin) { Fabricate(:user, admin: true) }
before do
Setting.bootstrap_timeline_accounts = nil
subject.call(source_account)
end
it 'follows admin accounts from account' do
expect(source_account.following?(admin.account)).to be true
end
end
context 'when setting is set' do
let!(:alice) { Fabricate(:account, username: 'alice') }
let!(:bob) { Fabricate(:account, username: 'bob') }
before do
Setting.bootstrap_timeline_accounts = 'alice, bob'
subject.call(source_account)
end
it 'follows found accounts from account' do
expect(source_account.following?(alice)).to be true
expect(source_account.following?(bob)).to be true
end
end
end
end