Add context and before to lengthy tag manager spec examples (#29129)

This commit is contained in:
Matt Jankowski 2024-02-08 05:03:04 -05:00 committed by GitHub
parent 5271131658
commit 15437e4ad9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,20 +52,27 @@ RSpec.describe ActivityPub::TagManager do
expect(subject.to(status)).to include(subject.followers_uri_for(mentioned)) expect(subject.to(status)).to include(subject.followers_uri_for(mentioned))
end end
it "returns URIs of mentions for direct silenced author's status only if they are followers or requesting to be" do context 'with followers and requested followers' do
bob = Fabricate(:account, username: 'bob') let!(:bob) { Fabricate(:account, username: 'bob') }
alice = Fabricate(:account, username: 'alice') let!(:alice) { Fabricate(:account, username: 'alice') }
foo = Fabricate(:account) let!(:foo) { Fabricate(:account) }
author = Fabricate(:account, username: 'author', silenced: true) let!(:author) { Fabricate(:account, username: 'author', silenced: true) }
status = Fabricate(:status, visibility: :direct, account: author) let!(:status) { Fabricate(:status, visibility: :direct, account: author) }
bob.follow!(author)
FollowRequest.create!(account: foo, target_account: author) before do
status.mentions.create(account: alice) bob.follow!(author)
status.mentions.create(account: bob) FollowRequest.create!(account: foo, target_account: author)
status.mentions.create(account: foo) status.mentions.create(account: alice)
expect(subject.to(status)).to include(subject.uri_for(bob)) status.mentions.create(account: bob)
expect(subject.to(status)).to include(subject.uri_for(foo)) status.mentions.create(account: foo)
expect(subject.to(status)).to_not include(subject.uri_for(alice)) end
it "returns URIs of mentions for direct silenced author's status only if they are followers or requesting to be" do
expect(subject.to(status))
.to include(subject.uri_for(bob))
.and include(subject.uri_for(foo))
.and not_include(subject.uri_for(alice))
end
end end
end end
@ -97,20 +104,27 @@ RSpec.describe ActivityPub::TagManager do
expect(subject.cc(status)).to include(subject.uri_for(mentioned)) expect(subject.cc(status)).to include(subject.uri_for(mentioned))
end end
it "returns URIs of mentions for silenced author's non-direct status only if they are followers or requesting to be" do context 'with followers and requested followers' do
bob = Fabricate(:account, username: 'bob') let!(:bob) { Fabricate(:account, username: 'bob') }
alice = Fabricate(:account, username: 'alice') let!(:alice) { Fabricate(:account, username: 'alice') }
foo = Fabricate(:account) let!(:foo) { Fabricate(:account) }
author = Fabricate(:account, username: 'author', silenced: true) let!(:author) { Fabricate(:account, username: 'author', silenced: true) }
status = Fabricate(:status, visibility: :public, account: author) let!(:status) { Fabricate(:status, visibility: :public, account: author) }
bob.follow!(author)
FollowRequest.create!(account: foo, target_account: author) before do
status.mentions.create(account: alice) bob.follow!(author)
status.mentions.create(account: bob) FollowRequest.create!(account: foo, target_account: author)
status.mentions.create(account: foo) status.mentions.create(account: alice)
expect(subject.cc(status)).to include(subject.uri_for(bob)) status.mentions.create(account: bob)
expect(subject.cc(status)).to include(subject.uri_for(foo)) status.mentions.create(account: foo)
expect(subject.cc(status)).to_not include(subject.uri_for(alice)) end
it "returns URIs of mentions for silenced author's non-direct status only if they are followers or requesting to be" do
expect(subject.cc(status))
.to include(subject.uri_for(bob))
.and include(subject.uri_for(foo))
.and not_include(subject.uri_for(alice))
end
end end
it 'returns poster of reblogged post, if reblog' do it 'returns poster of reblogged post, if reblog' do