forked from mirrors/catstodon
Add context
and before
to lengthy tag manager spec examples (#29129)
This commit is contained in:
parent
5271131658
commit
15437e4ad9
1 changed files with 42 additions and 28 deletions
|
@ -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) }
|
||||||
|
|
||||||
|
before do
|
||||||
bob.follow!(author)
|
bob.follow!(author)
|
||||||
FollowRequest.create!(account: foo, target_account: author)
|
FollowRequest.create!(account: foo, target_account: author)
|
||||||
status.mentions.create(account: alice)
|
status.mentions.create(account: alice)
|
||||||
status.mentions.create(account: bob)
|
status.mentions.create(account: bob)
|
||||||
status.mentions.create(account: foo)
|
status.mentions.create(account: foo)
|
||||||
expect(subject.to(status)).to include(subject.uri_for(bob))
|
end
|
||||||
expect(subject.to(status)).to include(subject.uri_for(foo))
|
|
||||||
expect(subject.to(status)).to_not include(subject.uri_for(alice))
|
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) }
|
||||||
|
|
||||||
|
before do
|
||||||
bob.follow!(author)
|
bob.follow!(author)
|
||||||
FollowRequest.create!(account: foo, target_account: author)
|
FollowRequest.create!(account: foo, target_account: author)
|
||||||
status.mentions.create(account: alice)
|
status.mentions.create(account: alice)
|
||||||
status.mentions.create(account: bob)
|
status.mentions.create(account: bob)
|
||||||
status.mentions.create(account: foo)
|
status.mentions.create(account: foo)
|
||||||
expect(subject.cc(status)).to include(subject.uri_for(bob))
|
end
|
||||||
expect(subject.cc(status)).to include(subject.uri_for(foo))
|
|
||||||
expect(subject.cc(status)).to_not include(subject.uri_for(alice))
|
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
|
||||||
|
|
Loading…
Reference in a new issue