Unwind map on single-item array in spec/services/delete_account_service spec (#28358)
				
					
				
			This commit is contained in:
		
							parent
							
								
									e17faedffb
								
							
						
					
					
						commit
						db897eaa5a
					
				
					 1 changed files with 32 additions and 26 deletions
				
			
		|  | @ -50,11 +50,11 @@ RSpec.describe DeleteAccountService, type: :service do | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def delete_associated_target_records |     def delete_associated_target_records | ||||||
|       change do |       change(account_pins_for_account, :count).from(1).to(0) | ||||||
|         [ |     end | ||||||
|           AccountPin.where(target_account: account), | 
 | ||||||
|         ].map(&:count) |     def account_pins_for_account | ||||||
|       end.from([1]).to([0]) |       AccountPin.where(target_account: account) | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def delete_associated_target_notifications |     def delete_associated_target_notifications | ||||||
|  | @ -100,28 +100,34 @@ RSpec.describe DeleteAccountService, type: :service do | ||||||
|       it 'sends expected activities to followed and follower inboxes' do |       it 'sends expected activities to followed and follower inboxes' do | ||||||
|         subject |         subject | ||||||
| 
 | 
 | ||||||
|         expect(a_request(:post, account.inbox_url).with( |         expect(post_to_inbox_with_reject).to have_been_made.once | ||||||
|                  body: |         expect(post_to_inbox_with_undo).to have_been_made.once | ||||||
|                    hash_including({ |       end | ||||||
|                      'type' => 'Reject', |  | ||||||
|                      'object' => hash_including({ |  | ||||||
|                        'type' => 'Follow', |  | ||||||
|                        'actor' => account.uri, |  | ||||||
|                        'object' => ActivityPub::TagManager.instance.uri_for(local_follower), |  | ||||||
|                      }), |  | ||||||
|                    }) |  | ||||||
|                )).to have_been_made.once |  | ||||||
| 
 | 
 | ||||||
|         expect(a_request(:post, account.inbox_url).with( |       def post_to_inbox_with_undo | ||||||
|                  body: hash_including({ |         a_request(:post, account.inbox_url).with( | ||||||
|                    'type' => 'Undo', |           body: hash_including({ | ||||||
|                    'object' => hash_including({ |             'type' => 'Undo', | ||||||
|                      'type' => 'Follow', |             'object' => hash_including({ | ||||||
|                      'actor' => ActivityPub::TagManager.instance.uri_for(local_follower), |               'type' => 'Follow', | ||||||
|                      'object' => account.uri, |               'actor' => ActivityPub::TagManager.instance.uri_for(local_follower), | ||||||
|                    }), |               'object' => account.uri, | ||||||
|                  }) |             }), | ||||||
|                )).to have_been_made.once |           }) | ||||||
|  |         ) | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       def post_to_inbox_with_reject | ||||||
|  |         a_request(:post, account.inbox_url).with( | ||||||
|  |           body: hash_including({ | ||||||
|  |             'type' => 'Reject', | ||||||
|  |             'object' => hash_including({ | ||||||
|  |               'type' => 'Follow', | ||||||
|  |               'actor' => account.uri, | ||||||
|  |               'object' => ActivityPub::TagManager.instance.uri_for(local_follower), | ||||||
|  |             }), | ||||||
|  |           }) | ||||||
|  |         ) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue