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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 15:06:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-26 15:06:00 +0300
commit5707f305f4b961e24369fcdaecf0b8ce1c34bad8 (patch)
tree3b291653b83b3e6c2bffc77c54527fbe6f6373be /spec/spec_helper.rb
parent759cd6c2985088d187ed519f2a881c2c690b34ec (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 18bfe5a2be7..364c033900f 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -160,6 +160,25 @@ RSpec.configure do |config|
allow(Gitlab::Git::KeepAround).to receive(:execute)
Gitlab::ThreadMemoryCache.cache_backend.clear
+
+ # Temporary patch to force admin mode to be active by default in tests when
+ # using the feature flag :user_mode_in_session, since this will require
+ # modifying a significant number of specs to test both states for admin
+ # mode enabled / disabled.
+ #
+ # See https://gitlab.com/gitlab-org/gitlab/issues/31511
+ # See gitlab/spec/support/helpers/admin_mode_helpers.rb
+ #
+ # If it is required to have the real behaviour that an admin is signed in
+ # with normal user mode and needs to switch to admin mode, it is possible to
+ # mark such tests with the `do_not_mock_admin_mode` metadata tag, e.g:
+ #
+ # context 'some test with normal user mode', :do_not_mock_admin_mode do ... end
+ unless example.metadata[:do_not_mock_admin_mode]
+ allow_any_instance_of(Gitlab::Auth::CurrentUserMode).to receive(:admin_mode?) do |current_user_mode|
+ current_user_mode.send(:user)&.admin?
+ end
+ end
end
config.around(:example, :quarantine) do |example|