From db297e9b6d579668a33c0cb71db4f5643f081896 Mon Sep 17 00:00:00 2001 From: Jarkko Laine Date: Tue, 6 Oct 2020 17:12:26 +0300 Subject: [PATCH] Spec --- spec/features/two_factor_authenticatable_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/features/two_factor_authenticatable_spec.rb b/spec/features/two_factor_authenticatable_spec.rb index 0ca47bca..e31a9f9b 100644 --- a/spec/features/two_factor_authenticatable_spec.rb +++ b/spec/features/two_factor_authenticatable_spec.rb @@ -152,6 +152,21 @@ expect(page).to have_content("Enter the code that was sent to you") end + scenario 'Sends OTP code by SMS' do + login_as user + SMSProvider.messages.clear() + visit dashboard_path + expect(SMSProvider.messages).not_to be_empty + end + + scenario "Doesn't sends OTP code by SMS upon every request if so configured" do + login_as user + SMSProvider.messages.clear() + allow(Rails.application.config.devise).to receive(:skip_send_new_otp_in_after_set_user_for).and_return([:user]) + visit dashboard_path + expect(SMSProvider.messages).to be_empty + end + scenario 'TFA should be different for different users' do sms_sign_in