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/help_controller_spec.rb')
-rw-r--r--spec/controllers/help_controller_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index 629d9b50d73..71d9cab7280 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -132,6 +132,18 @@ RSpec.describe HelpController do
expect(response).to redirect_to(new_user_session_path)
end
end
+
+ context 'when two factor is required' do
+ before do
+ stub_two_factor_required
+ end
+
+ it 'does not redirect to two factor auth' do
+ get :index
+
+ expect(response).not_to redirect_to(profile_two_factor_auth_path)
+ end
+ end
end
describe 'GET #show' do
@@ -152,6 +164,16 @@ RSpec.describe HelpController do
end
it_behaves_like 'documentation pages local render'
+
+ context 'when two factor is required' do
+ before do
+ stub_two_factor_required
+ end
+
+ it 'does not redirect to two factor auth' do
+ expect(response).not_to redirect_to(profile_two_factor_auth_path)
+ end
+ end
end
context 'when a custom help_page_documentation_url is set in database' do
@@ -254,4 +276,9 @@ RSpec.describe HelpController do
def stub_readme(content)
expect_file_read(Rails.root.join('doc', 'README.md'), content: content)
end
+
+ def stub_two_factor_required
+ allow(controller).to receive(:two_factor_authentication_required?).and_return(true)
+ allow(controller).to receive(:current_user_requires_two_factor?).and_return(true)
+ end
end