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

Followup to 5c38e55dc9
This commit is contained in:
David Taylor 2023-11-21 10:45:51 +00:00 committed by GitHub
parent a12f4ebee2
commit 91fe91e03b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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)