mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 07:05:20 +00:00
Reduce factories (36 > 12) in AccountReachFinder
spec (#32482)
This commit is contained in:
parent
92bb19773a
commit
6a39212b02
|
@ -38,16 +38,23 @@ RSpec.describe AccountReachFinder do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#inboxes' do
|
describe '#inboxes' do
|
||||||
it 'includes the preferred inbox URL of followers' do
|
subject { described_class.new(account).inboxes }
|
||||||
expect(described_class.new(account).inboxes).to include(*[ap_follower_example_com, ap_follower_example_org, ap_follower_with_shared].map(&:preferred_inbox_url))
|
|
||||||
|
it 'includes the preferred inbox URL of followers and recently mentioned accounts but not unrelated users' do
|
||||||
|
expect(subject)
|
||||||
|
.to include(*follower_inbox_urls)
|
||||||
|
.and include(*mentioned_account_inbox_urls)
|
||||||
|
.and not_include(unrelated_account.preferred_inbox_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'includes the preferred inbox URL of recently-mentioned accounts' do
|
def follower_inbox_urls
|
||||||
expect(described_class.new(account).inboxes).to include(*[ap_mentioned_with_shared, ap_mentioned_example_com, ap_mentioned_example_org].map(&:preferred_inbox_url))
|
[ap_follower_example_com, ap_follower_example_org, ap_follower_with_shared]
|
||||||
|
.map(&:preferred_inbox_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not include the inbox of unrelated users' do
|
def mentioned_account_inbox_urls
|
||||||
expect(described_class.new(account).inboxes).to_not include(unrelated_account.preferred_inbox_url)
|
[ap_mentioned_with_shared, ap_mentioned_example_com, ap_mentioned_example_org]
|
||||||
|
.map(&:preferred_inbox_url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue