mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 08:11:37 +01:00
Examples for Status.as_public_timeline.
Also adjust the examples for Status.as_tag_timeline to match the nomenclature used in .as_public_timeline (e.g. "account" -> "viewer").
This commit is contained in:
parent
e35a350119
commit
6abb0950c6
1 changed files with 32 additions and 6 deletions
|
@ -586,6 +586,32 @@ RSpec.describe Status, type: :model do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with local-only statuses' do
|
||||||
|
let(:status) { Fabricate(:status, local_only: true) }
|
||||||
|
|
||||||
|
subject { Status.as_public_timeline(viewer) }
|
||||||
|
|
||||||
|
context 'without a viewer' do
|
||||||
|
let(:viewer) { nil }
|
||||||
|
|
||||||
|
it 'excludes local-only statuses' do
|
||||||
|
expect(subject).to_not include(status)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with a viewer' do
|
||||||
|
let(:viewer) { Fabricate(:account, username: 'viewer') }
|
||||||
|
|
||||||
|
it 'includes local-only statuses' do
|
||||||
|
expect(subject).to include(status)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO: What happens if the viewer is remote?
|
||||||
|
# Can the viewer be remote?
|
||||||
|
# What prevents the viewer from being remote?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.as_tag_timeline' do
|
describe '.as_tag_timeline' do
|
||||||
|
@ -612,19 +638,19 @@ RSpec.describe Status, type: :model do
|
||||||
let(:tag) { Fabricate(:tag) }
|
let(:tag) { Fabricate(:tag) }
|
||||||
let(:status) { Fabricate(:status, local_only: true, tags: [tag]) }
|
let(:status) { Fabricate(:status, local_only: true, tags: [tag]) }
|
||||||
|
|
||||||
context 'if account is nil' do
|
context 'without a viewer' do
|
||||||
let(:account) { nil }
|
let(:viewer) { nil }
|
||||||
|
|
||||||
it 'filters the local-only status out of the result set' do
|
it 'filters the local-only status out of the result set' do
|
||||||
expect(Status.as_tag_timeline(tag, account)).not_to include(status)
|
expect(Status.as_tag_timeline(tag, viewer)).not_to include(status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'if account is not nil and local' do
|
context 'with a viewer' do
|
||||||
let(:account) { Fabricate(:account, domain: nil) }
|
let(:viewer) { Fabricate(:account, username: 'viewer', domain: nil) }
|
||||||
|
|
||||||
it 'keeps the local-only status in the result set' do
|
it 'keeps the local-only status in the result set' do
|
||||||
expect(Status.as_tag_timeline(tag, account)).to include(status)
|
expect(Status.as_tag_timeline(tag, viewer)).to include(status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue