DEV: Add test to ensure :after_auth event is triggered (#8400)

Follow-up to ee8669d778ad46cb65265042eac4c58e9af0bf16.
This commit is contained in:
Dan Ungureanu
2019-11-25 14:31:57 +02:00
committed by GitHub
parent 60ccfcaa6c
commit ae9e881333
3 changed files with 92 additions and 90 deletions

View File

@ -195,7 +195,8 @@ RSpec.describe Users::OmniauthCallbacksController do
destination_url = '/somepath'
Rails.application.env_config["omniauth.origin"] = destination_url
get "/auth/google_oauth2/callback.json"
events = DiscourseEvent.track_events { get "/auth/google_oauth2/callback.json" }
expect(events.any? { |e| e[:event_name] === :after_auth && Auth::GoogleOAuth2Authenticator === e[:params][0] && !e[:params][1].failed? }).to eq(true)
expect(response.status).to eq(302)