Log admin approve and reject account (#22088)
* Log admin approve and reject account * Add unit tests for approve and reject logging
This commit is contained in:
		
					parent
					
						
							
								c8849d6cee
							
						
					
				
			
			
				commit
				
					
						f6492a7c4d
					
				
			
		
					 4 changed files with 103 additions and 0 deletions
				
			
		|  | @ -100,6 +100,15 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do | |||
|     it 'approves user' do | ||||
|       expect(account.reload.user_approved?).to be true | ||||
|     end | ||||
| 
 | ||||
|     it 'logs action' do | ||||
|       log_item = Admin::ActionLog.last | ||||
| 
 | ||||
|       expect(log_item).to_not be_nil | ||||
|       expect(log_item.action).to eq :approve | ||||
|       expect(log_item.account_id).to eq user.account_id | ||||
|       expect(log_item.target_id).to eq account.user.id | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   describe 'POST #reject' do | ||||
|  | @ -118,6 +127,15 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do | |||
|     it 'removes user' do | ||||
|       expect(User.where(id: account.user.id).count).to eq 0 | ||||
|     end | ||||
| 
 | ||||
|     it 'logs action' do | ||||
|       log_item = Admin::ActionLog.last | ||||
| 
 | ||||
|       expect(log_item).to_not be_nil | ||||
|       expect(log_item.action).to eq :reject | ||||
|       expect(log_item.account_id).to eq user.account_id | ||||
|       expect(log_item.target_id).to eq account.user.id | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   describe 'POST #enable' do | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue