diff options
author | Takeshi Umeda <noel.yoshiba@gmail.com> | 2020-05-10 17:36:18 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 10:36:18 +0200 |
commit | 26b08a3c54847f2816f78c3ac67ace001d3fea1f (patch) | |
tree | 9512f3ec81de5bd70b4b544475c84aecf1a58110 /spec/models | |
parent | e9ecbca70d28c775a9eeda7670e06443a1037d5b (diff) |
Add remote only to public timeline (#13504)
* Add remote only to public timeline * Fix code style
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/status_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 9c1eca1b5..4aee14cbd 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -374,6 +374,33 @@ RSpec.describe Status, type: :model do end end + context 'with a remote_only option set' do + let!(:local_account) { Fabricate(:account, domain: nil) } + let!(:remote_account) { Fabricate(:account, domain: 'test.com') } + let!(:local_status) { Fabricate(:status, account: local_account) } + let!(:remote_status) { Fabricate(:status, account: remote_account) } + + subject { Status.as_public_timeline(viewer, :remote) } + + context 'without a viewer' do + let(:viewer) { nil } + + it 'does not include local instances statuses' do + expect(subject).not_to include(local_status) + expect(subject).to include(remote_status) + end + end + + context 'with a viewer' do + let(:viewer) { Fabricate(:account, username: 'viewer') } + + it 'does not include local instances statuses' do + expect(subject).not_to include(local_status) + expect(subject).to include(remote_status) + end + end + end + describe 'with an account passed in' do before do @account = Fabricate(:account) |