summaryrefslogtreecommitdiff
path: root/spec/services/users/validate_otp_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/users/validate_otp_service_spec.rb')
-rw-r--r--spec/services/users/validate_otp_service_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/services/users/validate_otp_service_spec.rb b/spec/services/users/validate_otp_service_spec.rb
index 826755d6145..42f0c10488c 100644
--- a/spec/services/users/validate_otp_service_spec.rb
+++ b/spec/services/users/validate_otp_service_spec.rb
@@ -20,7 +20,8 @@ RSpec.describe Users::ValidateOtpService do
context 'FortiAuthenticator' do
before do
- stub_feature_flags(forti_authenticator: true)
+ stub_feature_flags(forti_authenticator: user)
+ allow(::Gitlab.config.forti_authenticator).to receive(:enabled).and_return(true)
end
it 'calls FortiAuthenticator strategy' do
@@ -31,4 +32,19 @@ RSpec.describe Users::ValidateOtpService do
validate
end
end
+
+ context 'FortiTokenCloud' do
+ before do
+ stub_feature_flags(forti_token_cloud: user)
+ allow(::Gitlab.config.forti_token_cloud).to receive(:enabled).and_return(true)
+ end
+
+ it 'calls FortiTokenCloud strategy' do
+ expect_next_instance_of(::Gitlab::Auth::Otp::Strategies::FortiTokenCloud) do |strategy|
+ expect(strategy).to receive(:validate).with(otp_code).once
+ end
+
+ validate
+ end
+ end
end