about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2017-09-10 14:10:30 -0500
committerGitHub <noreply@github.com>2017-09-10 14:10:30 -0500
commit7a9c7d4e0b694e716cb018e3057792b4d86026fa (patch)
tree973b16e23a7cbeaf5a43550444e54aa1ace50a46 /spec/services
parentc9df53044a333276853f7dc7ef2aed6d48df087f (diff)
parent932571fa22273e6ff5c229147668c426b4d65326 (diff)
Merge pull request #143 from yipdw/sync/upstream
Merge with upstream's 1.6.0
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/bootstrap_timeline_service_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/services/bootstrap_timeline_service_spec.rb b/spec/services/bootstrap_timeline_service_spec.rb
new file mode 100644
index 000000000..5189b1de8
--- /dev/null
+++ b/spec/services/bootstrap_timeline_service_spec.rb
@@ -0,0 +1,37 @@
+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