Use sidekiq_inline in admin/account_action model spec (#30565)
				
					
				
			This commit is contained in:
		
							parent
							
								
									1ffc293b86
								
							
						
					
					
						commit
						a662c6d1d8
					
				| @ -69,20 +69,22 @@ RSpec.describe Admin::AccountAction do | |||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     it 'sends notification, log the action, and closes other reports', :aggregate_failures do |     it 'sends email to target account user', :sidekiq_inline do | ||||||
|       other_report = Fabricate(:report, target_account: target_account) |       emails = capture_emails { subject } | ||||||
| 
 |  | ||||||
|       emails = [] |  | ||||||
|       expect do |  | ||||||
|         emails = capture_emails { subject } |  | ||||||
|       end.to (change(Admin::ActionLog.where(action: type), :count).by 1) |  | ||||||
|          .and(change { other_report.reload.action_taken? }.from(false).to(true)) |  | ||||||
| 
 | 
 | ||||||
|       expect(emails).to contain_exactly( |       expect(emails).to contain_exactly( | ||||||
|         have_attributes( |         have_attributes( | ||||||
|           to: contain_exactly(target_account.user.email) |           to: contain_exactly(target_account.user.email) | ||||||
|         ) |         ) | ||||||
|       ) |       ) | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|  |     it 'sends notification, log the action, and closes other reports', :aggregate_failures do | ||||||
|  |       other_report = Fabricate(:report, target_account: target_account) | ||||||
|  | 
 | ||||||
|  |       expect { subject } | ||||||
|  |         .to (change(Admin::ActionLog.where(action: type), :count).by 1) | ||||||
|  |         .and(change { other_report.reload.action_taken? }.from(false).to(true)) | ||||||
| 
 | 
 | ||||||
|       expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(target_account.id, anything, 'AccountWarning', 'moderation_warning') |       expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(target_account.id, anything, 'AccountWarning', 'moderation_warning') | ||||||
|     end |     end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user