From 91fe91e03bb784bb039640b6ab9f15dca52da49b Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 21 Nov 2023 10:45:51 +0000 Subject: [PATCH] DEV: Properly cleanup auth providers in test (#24482) Followup to 5c38e55dc9047c121d7727352e994041d26ce95 --- spec/requests/omniauth_callbacks_controller_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rb index 5aafe05a247..c9ccf3bf4bd 100644 --- a/spec/requests/omniauth_callbacks_controller_spec.rb +++ b/spec/requests/omniauth_callbacks_controller_spec.rb @@ -1125,13 +1125,15 @@ RSpec.describe Users::OmniauthCallbacksController do end end + let(:fake_auth_provider) { Auth::AuthProvider.new(authenticator: FakeAuthenticator.new) } + before do - DiscoursePluginRegistry.register_auth_provider( - Auth::AuthProvider.new(authenticator: FakeAuthenticator.new), - ) + DiscoursePluginRegistry.register_auth_provider(fake_auth_provider) OmniAuth.config.test_mode = false end + after { DiscoursePluginRegistry.auth_providers.delete(fake_auth_provider) } + it "does not run 'other_phase' for disabled auth methods" do get "/auth/fake/blah" expect(response.status).to eq(404)