Skip to content

A platform for community discussion. Free, open, simple.

DEV: Properly cleanup auth providers in test (#24482)

David Taylor91fe91e03bb7
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)