Spec #destroy feature of Admin::TwoFactorAuthenticationsController (#3355)
This commit is contained in:
		
							parent
							
								
									2c10c5a069
								
							
						
					
					
						commit
						2e27ce3b61
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,7 @@ require 'rails_helper'
 | 
			
		|||
describe Admin::TwoFactorAuthenticationsController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  let(:user) { Fabricate(:user) }
 | 
			
		||||
  let(:user) { Fabricate(:user, otp_required_for_login: true) }
 | 
			
		||||
  before do
 | 
			
		||||
    sign_in Fabricate(:user, admin: true), scope: :user
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -11,6 +11,9 @@ describe Admin::TwoFactorAuthenticationsController do
 | 
			
		|||
  describe 'DELETE #destroy' do
 | 
			
		||||
    it 'redirects to admin accounts page' do
 | 
			
		||||
      delete :destroy, params: { user_id: user.id }
 | 
			
		||||
 | 
			
		||||
      user.reload
 | 
			
		||||
      expect(user.otp_required_for_login).to eq false
 | 
			
		||||
      expect(response).to redirect_to(admin_accounts_path)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue