Reduce extra round trips in AP::SynchronizeFollowersService spec (#31044)
				
					
				
			This commit is contained in:
		
							parent
							
								
									81877e7950
								
							
						
					
					
						commit
						f5e90f3de3
					
				| @ -13,11 +13,9 @@ RSpec.describe ActivityPub::SynchronizeFollowersService do | |||||||
|   let(:collection_uri) { 'http://example.com/partial-followers' } |   let(:collection_uri) { 'http://example.com/partial-followers' } | ||||||
| 
 | 
 | ||||||
|   let(:items) do |   let(:items) do | ||||||
|     [ |     [alice, eve, mallory].map do |account| | ||||||
|       ActivityPub::TagManager.instance.uri_for(alice), |       ActivityPub::TagManager.instance.uri_for(account) | ||||||
|       ActivityPub::TagManager.instance.uri_for(eve), |     end | ||||||
|       ActivityPub::TagManager.instance.uri_for(mallory), |  | ||||||
|     ] |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   let(:payload) do |   let(:payload) do | ||||||
| @ -40,20 +38,15 @@ RSpec.describe ActivityPub::SynchronizeFollowersService do | |||||||
|       subject.call(actor, collection_uri) |       subject.call(actor, collection_uri) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     it 'keeps expected followers' do |     it 'maintains following records and sends Undo Follow to actor' do | ||||||
|       expect(alice.following?(actor)).to be true |       expect(alice) | ||||||
|     end |         .to be_following(actor) # Keep expected followers | ||||||
| 
 |       expect(bob) | ||||||
|     it 'removes local followers not in the remote list' do |         .to_not be_following(actor) # Remove local followers not in remote list | ||||||
|       expect(bob.following?(actor)).to be false |       expect(mallory) | ||||||
|     end |         .to be_following(actor) # Convert follow request to follow when accepted | ||||||
| 
 |       expect(ActivityPub::DeliveryWorker) | ||||||
|     it 'converts follow requests to follow relationships when they have been accepted' do |         .to have_received(:perform_async).with(anything, eve.id, actor.inbox_url) # Send Undo Follow to actor | ||||||
|       expect(mallory.following?(actor)).to be true |  | ||||||
|     end |  | ||||||
| 
 |  | ||||||
|     it 'sends an Undo Follow to the actor' do |  | ||||||
|       expect(ActivityPub::DeliveryWorker).to have_received(:perform_async).with(anything, eve.id, actor.inbox_url) |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user