Refactor StatusReachFinder to be used in more places
This commit is contained in:
parent
c99d28369a
commit
ce463ccb50
13 changed files with 321 additions and 99 deletions
|
@ -1,7 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RemoveStatusService, type: :service do
|
||||
subject { RemoveStatusService.new }
|
||||
subject { described_class.new }
|
||||
|
||||
let!(:alice) { Fabricate(:account, user: Fabricate(:user)) }
|
||||
let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') }
|
||||
|
@ -21,14 +21,18 @@ RSpec.describe RemoveStatusService, type: :service do
|
|||
Fabricate(:status, account: bill, reblog: @status, uri: 'hoge')
|
||||
end
|
||||
|
||||
def home_feed_of(account)
|
||||
HomeFeed.new(account).get(10).map(&:id)
|
||||
end
|
||||
|
||||
it 'removes status from author\'s home feed' do
|
||||
subject.call(@status)
|
||||
expect(HomeFeed.new(alice).get(10)).to_not include(@status.id)
|
||||
expect(home_feed_of(alice)).to_not include(@status.id)
|
||||
end
|
||||
|
||||
it 'removes status from local follower\'s home feed' do
|
||||
subject.call(@status)
|
||||
expect(HomeFeed.new(jeff).get(10)).to_not include(@status.id)
|
||||
expect(home_feed_of(jeff)).to_not include(@status.id)
|
||||
end
|
||||
|
||||
it 'sends delete activity to followers' do
|
||||
|
@ -38,7 +42,7 @@ RSpec.describe RemoveStatusService, type: :service do
|
|||
|
||||
it 'sends delete activity to rebloggers' do
|
||||
subject.call(@status)
|
||||
expect(a_request(:post, 'http://example2.com/inbox')).to have_been_made
|
||||
expect(a_request(:post, 'http://example2.com/inbox')).to have_been_made.once
|
||||
end
|
||||
|
||||
it 'remove status from notifications' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue