Created
July 27, 2026 13:49
-
-
Save alkesh/27544db112af7b2b9efe889c01c4c5d1 to your computer and use it in GitHub Desktop.
Omniauth Controller Spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rails_helper" | |
| RSpec.describe OmniauthController do | |
| let(:old_user) { create(:user, :with_teacher_auth) } | |
| let(:user) { create(:user, :with_teacher_auth) } | |
| let(:feature_flag_id) { "some-feature-flag-id" } | |
| let(:log_session_id) { "some-log-session-id" } | |
| before do | |
| request.env["devise.mapping"] = Devise.mappings[:user] | |
| request.env["omniauth.auth"] = create(:omniauth_auth_hash) | |
| allow(User).to receive(:find_or_create_from_teacher_auth).and_return(user) | |
| session["user_id"] = old_user.id | |
| session["feature_flag_id"] = feature_flag_id | |
| end | |
| it do | |
| post :teacher_auth | |
| expect(session["feature_flag_id"]).to eq(feature_flag_id) | |
| expect(session["user_id"]).to eq(user.id) | |
| expect(session["log_session_id"]).to eq(log_session_id) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment