diff options
Diffstat (limited to 'spec/support/helpers/admin_mode_helpers.rb')
-rw-r--r-- | spec/support/helpers/admin_mode_helpers.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/spec/support/helpers/admin_mode_helpers.rb b/spec/support/helpers/admin_mode_helpers.rb index 36ed262f8ae..a6e31791127 100644 --- a/spec/support/helpers/admin_mode_helpers.rb +++ b/spec/support/helpers/admin_mode_helpers.rb @@ -13,6 +13,8 @@ module AdminModeHelper def enable_admin_mode!(user) fake_user_mode = instance_double(Gitlab::Auth::CurrentUserMode) + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).and_call_original + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).with(user).and_return(fake_user_mode) allow(fake_user_mode).to receive(:admin_mode?).and_return(user&.admin?) end |