summaryrefslogtreecommitdiff
path: root/spec/controllers/help_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /spec/controllers/help_controller_spec.rb
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
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