Reduce RSpec/MultipleExpectations cop max to 8 (#25313)
				
					
				
			This commit is contained in:
		@@ -56,18 +56,11 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        describe 'when creation succeeds' do
 | 
			
		||||
          let!(:otp_backup_codes) { user.generate_otp_backup_codes! }
 | 
			
		||||
 | 
			
		||||
          it 'renders page with success' do
 | 
			
		||||
            otp_backup_codes = user.generate_otp_backup_codes!
 | 
			
		||||
            expect_any_instance_of(User).to receive(:generate_otp_backup_codes!) do |value|
 | 
			
		||||
              expect(value).to eq user
 | 
			
		||||
              otp_backup_codes
 | 
			
		||||
            end
 | 
			
		||||
            expect_any_instance_of(User).to receive(:validate_and_consume_otp!) do |value, code, options|
 | 
			
		||||
              expect(value).to eq user
 | 
			
		||||
              expect(code).to eq '123456'
 | 
			
		||||
              expect(options).to eq({ otp_secret: 'thisisasecretforthespecofnewview' })
 | 
			
		||||
              true
 | 
			
		||||
            end
 | 
			
		||||
            prepare_user_otp_generation
 | 
			
		||||
            prepare_user_otp_consumption
 | 
			
		||||
 | 
			
		||||
            expect do
 | 
			
		||||
              post :create,
 | 
			
		||||
@@ -80,6 +73,22 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
 | 
			
		||||
            expect(response).to have_http_status(200)
 | 
			
		||||
            expect(response).to render_template('settings/two_factor_authentication/recovery_codes/index')
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def prepare_user_otp_generation
 | 
			
		||||
            expect_any_instance_of(User).to receive(:generate_otp_backup_codes!) do |value|
 | 
			
		||||
              expect(value).to eq user
 | 
			
		||||
              otp_backup_codes
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
 | 
			
		||||
          def prepare_user_otp_consumption
 | 
			
		||||
            expect_any_instance_of(User).to receive(:validate_and_consume_otp!) do |value, code, options|
 | 
			
		||||
              expect(value).to eq user
 | 
			
		||||
              expect(code).to eq '123456'
 | 
			
		||||
              expect(options).to eq({ otp_secret: 'thisisasecretforthespecofnewview' })
 | 
			
		||||
              true
 | 
			
		||||
            end
 | 
			
		||||
          end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        describe 'when creation fails' do
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user