add some explicit scoping to help avoid erratic failure in test

This commit is contained in:
Sam 2017-03-07 16:00:51 -05:00
parent 99f4d5082b
commit 8d80a5d97e

View File

@ -8,20 +8,20 @@ class Auth::GoogleOAuth2Authenticator < Auth::Authenticator
session_info = parse_hash(auth_hash)
google_hash = session_info[:google]
result = Auth::Result.new
result = ::Auth::Result.new
result.email = session_info[:email]
result.email_valid = session_info[:email_valid]
result.name = session_info[:name]
result.extra_data = google_hash
user_info = GoogleUserInfo.find_by(google_user_id: google_hash[:google_user_id])
user_info = ::GoogleUserInfo.find_by(google_user_id: google_hash[:google_user_id])
result.user = user_info.try(:user)
if !result.user && !result.email.blank? && result.email_valid
result.user = User.find_by_email(result.email)
if result.user
GoogleUserInfo.create({user_id: result.user.id}.merge(google_hash))
::GoogleUserInfo.create({user_id: result.user.id}.merge(google_hash))
end
end