OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add helper to disable 2FA stage redirects
Oliver Günther5acdcb178bcc
diff --git a/modules/openid_connect/spec/requests/openid_connect_spec.rb b/modules/openid_connect/spec/requests/openid_connect_spec.rbindex 170930c4301..e206e0b799e 100644--- a/modules/openid_connect/spec/requests/openid_connect_spec.rb+++ b/modules/openid_connect/spec/requests/openid_connect_spec.rb@@ -33,7 +33,9 @@ RSpec.configure do |c|c.include OpenIDConnectSpecHelpersend-describe 'OpenID Connect', type: :rails_request do+describe 'OpenID Connect',+ skip_2fa_stage: true, # Prevent redirects to 2FA stage+ type: :rails_request dolet(:host) { OmniAuth::OpenIDConnect::Heroku.new('foo', {}).host }let(:user_info) do{diff --git a/spec/controllers/account_controller_spec.rb b/spec/controllers/account_controller_spec.rbindex 781c767f575..c83b9391375 100644--- a/spec/controllers/account_controller_spec.rb+++ b/spec/controllers/account_controller_spec.rb@@ -28,7 +28,9 @@require 'spec_helper'-describe AccountController, type: :controller do+describe AccountController,+ skip_2fa_stage: true, # Prevent redirects to 2FA stage+ type: :controller doclass UserHook < OpenProject::Hook::ViewListenerattr_reader :registered_user, :first_login_userdiff --git a/spec/controllers/concerns/auth_source_sso_spec.rb b/spec/controllers/concerns/auth_source_sso_spec.rbindex e3c4262f776..3f387220911 100644--- a/spec/controllers/concerns/auth_source_sso_spec.rb+++ b/spec/controllers/concerns/auth_source_sso_spec.rb@@ -28,7 +28,9 @@require 'spec_helper'-describe MyController, type: :controller do+describe MyController,+ skip_2fa_stage: true, # Prevent redirects to 2FA stage+ type: :controller dorender_viewslet(:sso_config) dodiff --git a/spec/controllers/concerns/omniauth_login_spec.rb b/spec/controllers/concerns/omniauth_login_spec.rbindex e9116042b1c..59352c3d587 100644--- a/spec/controllers/concerns/omniauth_login_spec.rb+++ b/spec/controllers/concerns/omniauth_login_spec.rb@@ -29,7 +29,9 @@require 'spec_helper'# Concern is included into AccountController and depends on methods available there-describe AccountController, type: :controller do+describe AccountController,+ skip_2fa_stage: true, # Prevent redirects to 2FA stage+ type: :controller dolet(:omniauth_strategy) { double('Google Strategy', name: 'google') }let(:omniauth_hash) doOmniAuth::AuthHash.new(diff --git a/spec/features/auth/auth_stages_spec.rb b/spec/features/auth/auth_stages_spec.rbindex 1f925b8de18..1c567e1814e 100644--- a/spec/features/auth/auth_stages_spec.rb+++ b/spec/features/auth/auth_stages_spec.rb@@ -28,7 +28,9 @@require 'spec_helper'-describe 'Authentication Stages', type: :feature do+describe 'Authentication Stages',+ skip_2fa_stage: true, # Prevent redirects to 2FA stage+ type: :feature dobefore do@capybara_ignore_elements = Capybara.ignore_hidden_elementsCapybara.ignore_hidden_elements = truediff --git a/spec/requests/auth/auth_source_sso_spec.rb b/spec/requests/auth/auth_source_sso_spec.rbindex 91aa8ab9578..9cb837b3d3e 100644--- a/spec/requests/auth/auth_source_sso_spec.rb+++ b/spec/requests/auth/auth_source_sso_spec.rb@@ -29,6 +29,7 @@require 'spec_helper'describe AuthSourceSSO,+ skip_2fa_stage: true, # Prevent redirects to 2FA stagetype: :rails_request dolet(:sso_config) do{diff --git a/spec/support/shared/with_2fa.rb b/spec/support/shared/with_2fa.rbnew file mode 100644index 00000000000..a0b692e64da--- /dev/null+++ b/spec/support/shared/with_2fa.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++RSpec.configure do |config|+ config.before do |example|+ if example.metadata[:skip_2fa_stage]+ allow(::OpenProject::TwoFactorAuthentication::TokenStrategyManager)+ .to receive(:enabled?)+ .and_return false+ end+ end+end