Skip to content

Commit ac31a90

Browse files
chore: use OmniAuth internal classes instead of defining our own
This commits changes from defining our own custom classes in favor of `OmniAuth::AuthHash` and `OmniAuth::AuthHash::InfoHash` which are `OmniAuth` internal classes. Instances of those classes end up being passed to our `User.from_omniauth` method in production.
1 parent bb6200e commit ac31a90

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

test/models/user_test.rb

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
require 'test_helper'
22

33
class UserTest < ActiveSupport::TestCase
4-
class Auth < Struct.new(:provider, :uid, :info)
5-
end
6-
7-
class Auth::Info < Struct.new(:email)
8-
end
9-
104
test 'User.from_omniauth of a user that doesn\'t exist, should create a new user' do
11-
auth = Auth.new(
5+
auth = OmniAuth::AuthHash.new(
126
provider: 'google',
137
uid: '123456789',
14-
info: Auth::Info.new(
8+
info: OmniAuth::AuthHash::InfoHash.new(
159
email: 'user1@gmail.com'
1610
)
1711
)
@@ -27,10 +21,10 @@ class Auth::Info < Struct.new(:email)
2721
test 'User.from_omniauth of a user that exists, should update the user' do
2822
user = create :user
2923

30-
auth = Auth.new(
24+
auth = OmniAuth::AuthHash.new(
3125
provider: 'google',
3226
uid: '123456789',
33-
info: Auth::Info.new(
27+
info: OmniAuth::AuthHash::InfoHash.new(
3428
email: user.email
3529
)
3630
)

0 commit comments

Comments
 (0)