Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/profiles/two_factor_auths_controller_spec.rb')
-rw-r--r--spec/controllers/profiles/two_factor_auths_controller_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/controllers/profiles/two_factor_auths_controller_spec.rb b/spec/controllers/profiles/two_factor_auths_controller_spec.rb
index e57bd5be937..47086ccdd2c 100644
--- a/spec/controllers/profiles/two_factor_auths_controller_spec.rb
+++ b/spec/controllers/profiles/two_factor_auths_controller_spec.rb
@@ -62,6 +62,32 @@ RSpec.describe Profiles::TwoFactorAuthsController do
expect(flash[:alert]).to be_nil
end
end
+
+ context 'when password authentication is disabled' do
+ before do
+ stub_application_setting(password_authentication_enabled_for_web: false)
+ end
+
+ it 'does not require the current password', :aggregate_failures do
+ go
+
+ expect(response).not_to redirect_to(redirect_path)
+ expect(flash[:alert]).to be_nil
+ end
+ end
+
+ context 'when the user is an LDAP user' do
+ before do
+ allow(user).to receive(:ldap_user?).and_return(true)
+ end
+
+ it 'does not require the current password', :aggregate_failures do
+ go
+
+ expect(response).not_to redirect_to(redirect_path)
+ expect(flash[:alert]).to be_nil
+ end
+ end
end
describe 'GET show' do
@@ -149,7 +175,7 @@ RSpec.describe Profiles::TwoFactorAuthsController do
it 'assigns error' do
go
- expect(assigns[:error]).to eq _('Invalid pin code')
+ expect(assigns[:error]).to eq({ message: 'Invalid pin code.' })
end
it 'assigns qr_code' do